Broken provider when configuration references resource output from within the same script


I have a script where I create a managed RabbitMQ cluster and then I used the credentials returned by the service to initialise the rabbitmq provider. Something like this:

provider rabbitmq {
  endpoint = "https://${module.cloudamqp_broker.internal_host}"
  username = module.cloudamqp_broker.admin_username
  password = module.cloudamqp_broker.admin_password

It used to work with Terraform version 0.13 but now I’m trying to update to version 1 and I’m getting required field is not set errors for username and password, which I guess means providers can no longer reference other resources. Is there any way to fix this other than by splitting the script in two?

Hi @juanma-cvega,

This sounds like a problem with the provider itself. I can’t tell from the description if the problem is happening during the validation or configuration of the provider, but the behavior itself may be indicative of the provider using an outdated version of the SDK.

So should it still be possible to configure a provider with information available after the creation of a resource/module within the same script? I’m asking because maybe the description of the problem wasn’t clear enough. Both the managed cluster (created using in this case the cloudamqp provider) and the rabbitmq provider are created inside the same script.