terraform-provider-restapi
terraform-provider-restapi copied to clipboard
Allow empty uri in provider configuration
Hi,
We are using restapi provider to configure elasticsearch, which is created in the same terraform apply. It is not possible to set the uri parameter to the output of newly created resource (https://github.com/hashicorp/terraform/issues/2430). It will be great to have a possibility to leave provider's uri parameter empty.
For now we are using "clever" workaround:
provider "restapi" {
uri = "https:"
}
And in the resource:
resource "restapi_object" "elasticsearch_template_others" {
path = "//${aws_elasticsearch_domain.es.endpoint}/_template"
object_id = "template_2"
create_path = "//${aws_elasticsearch_domain.es.endpoint}/_template/{id}"
data = <<EOF
{
"index_patterns": [
"*"
],
"settings": {
"number_of_shards": "1",
"number_of_replicas": "1"
}
}
EOF
}
+1
@mraszplewicz thanks for workarround.
This should be fixed in terraform 0.12 beta just released.
AFAIK still an issue in terraform 0.15: https://github.com/hashicorp/terraform/issues/2430
A provider is initialised in the beginning prior any resources has been created. The consequence is that the uri
can't be set to a dynamic value, e.g a service's URI which is about to be deployed.
+1 on the solution by @mraszplewicz, to be able to have an empty uri
field in the provider.
Experiencing the same issue with where the api we want to leverage is created by the same terraform script.
Using terraform 0.15.3 . The workaround only worked for me when it was the default provider
Could a lazy init or something similar be done?
+1