Closed lmeadors closed 1 month ago
@lmeadors thanks for creating this issue!
I suspect it's a general terraform
issue where it requires all provider inputs to be known beforehand (i.e., passed as module variables or hardcoded), and in your scenario, confluent_api_key.env-manager-schema-registry-api-key.id = ""
. I'd recommend refactoring your code to use a module instead, to ensure these attributes aren't empty.
The provider not having the api key is somewhat incidental.
The bigger issue (in my mind, anyway) is that current example fails on the first application of it. I think that means that the environment resource is reporting that is all done and created before it actually is.
That in turn makes the data block fail to find the schema registry created by the environment resource falsely reporting that there are no SR clusters in "env-xxxxxx" environment, and the recovery from that failure is unintuitive.
It would be great if the environment returned the schema registry id (if defined) or that the data block to get the SR tried harder to find it. :D
I am not disagreeing that a more modular approach would be better (and I ended up refactoring my code to be that way), but rather that the example should either work as is or demonstrate the best practice.
the example should either work as is
💯
@lmeadors could you share the example URL so we could update it?
I started with this:
Then applied the changes mentioned here:
https://registry.terraform.io/providers/confluentinc/confluent/latest/docs/guides/version-2-upgrade
I would be happy to send a PR later this week if needed.
I am trying to convert the example at
examples/configurations/single-event-types-proto-schema-with-alias
to use the new approach to defining environments and schema registry, but it fails for me.I changed the environment and schema registry resources to look like this:
Then I changed the provider to look like this:
Running
terraform apply
fails the first time with this error:Running it a second time, it fails with this:
If I run this:
terraform apply -target=confluent_api_key.env-manager-schema-registry-api-key
then things get better - that creates the API key and then I can runterraform apply
to create everything else.