Hello - at VMware we are building NSXT provider that takes 2 parameters:
provider “nsxt” {
host = “{var.host}" vmc_token = "{var.vmc_token}”
}
I would like to be able to use the output of a module as “host” variable like:
provider “nsxt” {
host = “{module.SDDC.proxy_url}" vmc_token = "{var.vmc_token}”
}is this possible under terraform rules? i am immediately getting an error saying: " Error: host must be provided"
sorry for text formatting
Do you have a module instance named ‘SDDC’ which has an output named ‘proxyurl’ defined?
Modules may be tricky just because of how they interact with the graph. I think either recent or upcoming versions of Terraform have improvements around that. But given that this isn’t a Terraform provider development issue, you may find more success in the Terraform forum.
[edit] Eeek! I’m sorry. I thought this was posted in the SDK forum, not the Providers forum. I still think the Terraform forum would be more likely to yield an answer, but apologies for misreading like that [/edit]
yes indeed and this module returns the variable i need.
After many search and discussions, I came to the conclusion that this is not possible and Terraform need 2 stages to do that: first that will compute the “module.SDDC.proxy_url” and second phase that will take this output from the tfstate and apply.
I tested it and it’s OK
Are you defining the provider at the top level, or in a module?
top level for all providers. and then separated modules
It’s likely then that Terraform doesn’t include providers in the dependency graph in such a way that they can depend on module outputs.
I hit the same issue with the latest terraform 1.1.9 and nsxt 3.2.6 after years.
Is there any plan to improve this ?