terraform-provider-opensearch
terraform-provider-opensearch copied to clipboard
[BUG]Provider produced inconsistent final plan
What is the bug?
Provider produced inconsistent final plan when the 'body' value for resource opensearch_component_template changes from plan to apply. In my case the body template would be dynamically fetched from private repo using null_resource. So during plan phase its considering the "{}" value while actually apply returns a JSON template resulting into this issue.
How can one reproduce the bug?
locals{ component_templates_map = {"my-template1": "http://localnexus:8080/mytemplatefile1"} } resource "null_resource" "download_component_templates"{ Downloading file from the local nexus and redirecting the response body into the file }
resource "opensearch_component_template" "component_tempalte" { provider = opensearch.opensearch_provider for_each = local.component_templates_map name = each.key body = try(file("${path.module}/${each.key}_components.json"), "{}") depends_on = [null_resource.download_component_templates] }
Provider opensearch = { source = "opensearch-project/opensearch" version = "2.2.1" }
What is the expected behavior?
Open search component to be created.
What is your host/environment?
Linux
Do you have any screenshots?
Do you have any additional context?
Add any other context about the problem.
The attribute needs the same value for plan phase and apply phase, hence the error.
Further reference from https://github.com/hashicorp/terraform/issues/25090 : The general rule underlying that error is that if the plan for a particular attribute has a known value (anything other than "known after apply") during planning, the value must be exactly the same after the apply phase.
I got the error by updating the access rights of the data policy with a new value. Planning showed it was going to update, and it did so at the apply. However it then spit out the error right after. So there is a bug with the read after the update.
+1 on this, it is quite the struggle to get this piece working with AWS OpenSearch right now.
If I then try rerunning it again, I get this error:
ValidationException: No changes detected in policy or policy description