Skip to content

[Bug] elasticstack_elasticsearch_security_api_key resource "produced inconsistent result after apply" #1211

@bplies-ATX

Description

@bplies-ATX

Describe the bug
Attempting to create a elasticstack_elasticsearch_security_api_key succeeds in provisioning the key but results in the following error message

elasticstack_elasticsearch_security_api_key.jenkins_otel_api_key, provider
"provider["registry.terraform.io/elastic/elasticstack"]" produced an
unexpected new value: .role_descriptors: was
cty.StringVal("{"jenkins-otel":{"cluster":["monitor","read_ilm"],"indices":[{"names":["logs-apm.app*"],"privileges":["read","view_index_metadata"]}]}}"),
but now
cty.StringVal("{"jenkins-otel":{"cluster":["monitor","read_ilm"],"indices":[{"names":["logs-apm.app*"],"privileges":["read","view_index_metadata"],"allow_restricted_indices":false}]}}").

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

So that is why I created this issue.

To Reproduce
Steps to reproduce the behavior:

  1. TF configuration used '...'
resource "elasticstack_elasticsearch_security_api_key" "jenkins_otel_api_key" {
  name              = "Jenkins OTel API Key"
  role_descriptors  = jsonencode({
    jenkins-otel = {
      cluster = ["monitor", "read_ilm"],
      indices = [
        {
          names      = ["logs-apm.app*"], # Needed to show logs in Jenkins UI
          privileges = ["read", "view_index_metadata"]
        }
      ]
    }
}
  1. TF operations to execute to get the error '...' [e.g terraform plan,terraform apply, terraform destroy]
    terraform plan produced a valid plan
    terraform apply created the resource but returns an error.

  2. See the error in the output '...'

Expected behavior
Easy apply without error. Or improved documentation and validation for any required config.

Debug output
Not included.

Screenshots
N/A

Versions (please complete the following information):

  • Terraform Version 1.8.1
  • Provider version 0.11.16 (latest as of right now)
  • Elasticsearch Version 8.17.1

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions