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

subnet_ids not retained in state upon import for yandex_mdb_kafka_cluster resource #481

Open
alexmorbo opened this issue Nov 2, 2024 · 0 comments

Comments

@alexmorbo
Copy link

When importing a Kafka cluster using the yandex_mdb_kafka_cluster resource, the subnet_ids attribute is not retained in the Terraform state. This results in an in-place update being triggered during a terraform plan, as the state does not reflect the imported resource's subnet_ids.

Steps to Reproduce

1 - Import Kafka cluster:

terraform import yandex_mdb_kafka_cluster.cluster <cluster_id>

2 - Run plan to check the state:

terragrunt plan

Observed Behavior

The following plan is generated:

Terraform will perform the following actions:
  # yandex_mdb_kafka_cluster.cluster will be updated in-place
  ~ resource "yandex_mdb_kafka_cluster" "cluster" {
        id                  = "<cluster_id>"
        name                = "default"
      + subnet_ids          = [
          + "<subnet_id>",
          + "<subnet_id>",
          + "<subnet_id>",
        ]
        # (11 unchanged attributes hidden)
        # (2 unchanged blocks hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

3 - Attempting to apply the changes results in an error:

terraform apply --auto-approve

Error output:

Error: error while requesting API to update Kafka Cluster "<cluster_id>": server-request-id = 29a8624d-4593-48c9-9b8b-252d732130bf server-trace-id = b745c7733b4bf83e:8171927284a3849a:b745c7733b4bf83e:1 client-request-id = c4e1ffe9-bf26-4dc4-af9e-09fc419f4f96 client-trace-id = 0f2a093a-65d1-481e-bbd5-26d7ea27adc1 rpc error: code = FailedPrecondition desc = no changes detected

Expected Behavior

Upon importing yandex_mdb_kafka_cluster, the subnet_ids should be correctly populated in the state, so no in-place update is triggered during a subsequent plan.

Environment:
Provider version: 0.130.0
Terraform version: v1.6.6

This issue leads to failed apply attempts, as Terraform identifies no actual changes when calling the Yandex API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant