Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Provider produced inconsistent result after apply #219

Open
lukaszpilka opened this issue Oct 9, 2024 · 1 comment
Open

[BUG] Provider produced inconsistent result after apply #219

lukaszpilka opened this issue Oct 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lukaszpilka
Copy link

What is the bug?

When applying changes to opensearch_dashboard_object resources in multiple tenants, the provider produced inconsistent results after apply. The following error is thrown for random resources, and multiple runs of terraform apply are required to successfully create all resources:

Error: Provider produced inconsistent result after apply

When applying changes to opensearch_dashboard_object, provider "provider[\"registry.terraform.io/opensearch-project/opensearch\"]" produced an unexpected new value: Root resource was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

How can one reproduce the bug?

Define multiple opensearch_dashboard_object in a Terraform configuration.
Run terraform apply to create the resources.

Example:

resource "opensearch_dashboard_object" "local_index_pattern_v7" {
  for_each    = var.project_list
  tenant_name = each.key
  body        = <<EOF
[
  {
    "_id": "index-pattern:ck-${lower(each.key)}-local",
    "_source": {
      "type": "index-pattern",
      "index-pattern": {
        "title": "ck-${lower(each.key)}-*",
        "timeFieldName": "@timestamp"
      }
    }
  }
]
EOF

  lifecycle {
    ignore_changes = [body]
  }
}

resource "opensearch_dashboard_object" "global_index_pattern_v7" {
  for_each    = var.project_list
  tenant_name = each.key
  body        = <<EOF
[
  {
    "_id": "index-pattern:ck-${lower(each.key)}-global",
    "_source": {
      "type": "index-pattern",
      "index-pattern": {
        "title": "ck-*",
        "timeFieldName": "@timestamp"
      }
    }
  }
]
EOF

  lifecycle {
    ignore_changes = [body]
  }
}

What is the expected behavior?

All opensearch_dashboard_object resources should be created successfully in a single run of terraform apply without producing inconsistent results.

What is your host/environment?

Operating System: macOS
Terraform Version: 1.4
OpenSearch Provider Version: 2.3.1
Do you have any screenshots?
image
image
image

Do you have any additional context?

No.

@lukaszpilka
Copy link
Author

I have similar error when I am destroying these resources. Again, multiple terraform apply runs are required.

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📦 Backlog
Development

No branches or pull requests

2 participants