You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a tool to visualize the resource structure by analyzing the JSON output produced from terraform show -json command, and would like to identify which provider to be used for each resource.
Running terraform plan -out plan.out and terraform show -json plan.out will produce the JSON output. The resulting JSON contains the following provider configurations in configuration.provider_config.
null
null.provider_1
null.provider_2
module.a:null
module.b:null
The issue is that the result does not contain the relations between these providers, so we can't identify that null.provider_1 is assigned to module.a:null as well as null.provider_2 is assigned to module.b:null.
For example, when using AWS provider multiple providers could be defined in one project and each work for a different AWS region. In such case, currently we can not identify in which region the specific resource in a child module would be created from analyzing the JSON output.
Include PassedProviderConfig defined in ModuleCall struct into configuration.module_calls block of the JSON output so that tools can infer which provider is actually passed to child modules.
I think you've reported the same underlying problem as #30113 here, and so I'm going to close this to consolidate the discussion over there. There's already a pending PR to address this issue (albeit in a slightly different way than you proposed) and I believe it's only now pending some coordinated updates in other parts of the Terraform product which consume this JSON output.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Current Terraform Version
Use-cases
I'm working on a tool to visualize the resource structure by analyzing the JSON output produced from
terraform show -json
command, and would like to identify which provider to be used for each resource.Suppose we have the following tf file.
Running
terraform plan -out plan.out
andterraform show -json plan.out
will produce the JSON output. The resulting JSON contains the following provider configurations inconfiguration.provider_config
.The issue is that the result does not contain the relations between these providers, so we can't identify that
null.provider_1
is assigned tomodule.a:null
as well asnull.provider_2
is assigned tomodule.b:null
.For example, when using AWS provider multiple providers could be defined in one project and each work for a different AWS region. In such case, currently we can not identify in which region the specific resource in a child module would be created from analyzing the JSON output.
Attempted Solutions
I've created a repo containing all sample code and the actual JSON output file.
Proposal
Include
PassedProviderConfig
defined in ModuleCall struct intoconfiguration.module_calls
block of the JSON output so that tools can infer which provider is actually passed to child modules.References
The text was updated successfully, but these errors were encountered: