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.
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.
When importing a Kafka cluster using the
yandex_mdb_kafka_cluster
resource, thesubnet_ids
attribute is not retained in the Terraform state. This results in anin-place
update being triggered during aterraform plan
, as the state does not reflect the imported resource'ssubnet_ids
.Steps to Reproduce
1 - Import Kafka cluster:
2 - Run plan to check the state:
Observed Behavior
The following plan is generated:
3 - Attempting to apply the changes results in an error:
Error output:
Expected Behavior
Upon importing
yandex_mdb_kafka_cluster
, thesubnet_ids
should be correctly populated in the state, so noin-place
update is triggered during a subsequentplan
.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.