Mongey / terraform-provider-confluentcloud

A Terraform provider for managing resource in confluent.cloud
MIT License
110 stars 47 forks source link

Schema registry resource has wrong id, so Schema registry API key cannot be created #47

Closed askoriy closed 3 years ago

askoriy commented 3 years ago

ID of created confluentcloud_schema_registry is expected to be the ID in confluent.cloud API responce, like lsrc-n5z6d, similar to IDs of other resources created by terraform:

confluentcloud_environment -> id: "env-qp956"
confluentcloud_kafka_cluster -> id: "lkc-51gd2"

Instead, it has the value account schema-registry env-qp956. So with it there is no way to create Schema registry API key.

If the ID would be correct than Schema registry API key could be created with

resource "confluentcloud_api_key" "schema_registry_api_key" {
  environment_id = confluentcloud_environment.environment.id
  logical_clusters = [
    confluentcloud_schema_registry.registry.id
  ]
}

But Terraform returns an error: Error: api_keys: cluster, key, or account not found

I'm not sure if the problem is in Terraform module or in used go-client-confluent-cloud library

Mongey commented 3 years ago

Thanks for catching this @askoriy. I've got a pull request to address it. Given that the confluentcloud_schema_registry resource hasn't been included in a real release, I'm going to skip writing a state migration for this, but that'll mean that you need to manually update the ID of the resource in your state to reflect the new Id once you update the provider.

askoriy commented 3 years ago

Update ID in the state is not a problem. Thanks for quick reply and fix.