Skip to content

[BUG] Provider produced inconsistent result after apply #219

@lukaszpilka

Description

@lukaszpilka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📦 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions