Skip to content

[Bug] elasticstack_elasticsearch_security_role_mapping resources can no longer be imported #1440

@declanrobinson-futurefund

Description

Describe the bug
elasticstack_elasticsearch_security_role_mapping resources cannot be imported between versions 0.11.18 and 0.12.1 (inclusive), possibly due to the Plugin Framework Migration.

I've checked each of versions 0.12.1, 0.12.0, 0.11.19, and 0.11.18 exhibit the same issue.

Importing the same resource works as expected when pinning to version 0.11.17

To Reproduce
Steps to reproduce the behavior:
Ensure a Role Mapping resource named example exists, then try to import it into TF state with:

  1. TF configuration used '...'
resource "elasticstack_elasticsearch_security_role_mapping" "example" {
  name    = "test_role_mapping"
  enabled = true
  roles = [
    "admin"
  ]
  rules = jsonencode({
    any = [
      { field = { username = "esadmin" } },
      { field = { groups = "cn=admins,dc=example,dc=com" } },
    ]
  })
}
import {
  to = elasticstack_elasticsearch_security_role_mapping.example
  id = "${var.cluster_uuid}/example"
}
  1. TF operations to execute to get the error '...'
    terraform plan

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

  Error: -13T05:27:20.028Z [ERROR] provider.terraform-provider-elasticstack_v0.11.18: Response contains error diagnostic: diagnostic_detail="This resource does not support import. Please contact the provider developer for additional information." diagnostic_severity=ERROR tf_proto_version=6.10 tf_resource_type=elasticstack_elasticsearch_security_role_mapping tf_rpc=ImportResourceState @module=sdk.proto diagnostic_summary="Resource Import Not Implemented" tf_provider_addr=registry.terraform.io/elastic/elasticstack tf_req_id=eed5be2b-98fc-fc47-3da5-88a6c43e97f8 @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov6/internal/diag/diagnostics.go:58 timestamp=2025-11-13T05:27:20.028Z
  Error: -13T05:27:20.028Z [ERROR] vertex "elasticstack_elasticsearch_security_role_mapping.example" error: Resource Import Not Implemented
  Error: -13T05:27:20.028Z [ERROR] vertex "elasticstack_elasticsearch_security_role_mapping.example (expand)" error: Resource Import Not Implemented

Expected behavior
With provider version = "0.11.17":

  # elasticstack_elasticsearch_security_role_mapping.example will be imported
    resource "elasticstack_elasticsearch_security_role_mapping" "example" {
        enabled  = true
        id       = "<redacted>/example"
        metadata = jsonencode({})
        name     = "example"
        roles    = [
            "admin",
        ]
        rules = jsonencode({
          any = [
            { field = { username = "esadmin" } },
            { field = { groups = "cn=admins,dc=example,dc=com" } },
          ]
        })
    }

Debug output
can be provided on request

Screenshots
n/a

Versions (please complete the following information):

  • OS: Linux
  • Terraform Version: 1.13.5
  • Provider version: 0.11.18 - 0.12.1 inclusive
  • Elasticsearch Version: 8.17.3

Additional context

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