New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
terraform show does not properly associate resource configuration with provider when proxied #30113
Comments
For discussion: I see three ways to solve this problem: Solution 1Update the Provider struct in the internal/configs/provider.go to contain
where we could stuff the proxy provider address like Solution 2Update the
Solution 3Update the configuration for a module to include the provider mappings in the JSON output. If we had this, the output might look something like this: "root_module": {
"module_calls": {
"good": {
"providers": {
"aws": "aws",
"aws.second": "aws.west2"
},
// ...
} Thoughts? We are leaning toward solution 3 |
Hi @DaKaZ, thanks for the detailed report! This does seem like an enhancement rather than a bug, so I've marked it as such. Solution 3 makes the most sense to me also. Due to compatibility guarantees, we can't change the meaning of any of the existing fields in the JSON output, but adding a new It would be useful to know more about your use case for this, to ensure that any changes we make to the JSON are as robust to that as possible. If you can share any more details that would help. Thanks! |
Hi @alisdair - we use the JSON output against Policy as Code (similar to Sentinel). Example rules might be:
|
Hi @DaKaZ. I've been working on this issue again the past few days, and there is a new approach in review at #30138. If you have time to build and test from that branch to see if it addresses your issue, that would be great. Any comments you have on the design/implementation would be useful feedback too. Thanks! |
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. |
I am not sure if this is a bug or a feature request :)
When looking at the JSON output from a
terraform show
, we cannot associate the resource'sprovider_config_key
with the actual provider when we have a module using proxied providers. In this below example, the two resources in the good module have different AWS providers. If I wanted to determine which REGION each resource was going to be created in, I would need to know which providers are mapped into the module proxies. The current output shows (abbreviated):But the provider_configs only shows:
I believe that
provider_config["aws"]
andprovider_config["aws.west2"]
need a new key that maintains a list of which modules and the respective provider aliases they are mapped to. I am thinking something like:Terraform Version
Terraform Configuration Files
main.tf:
./good/main.tf
Steps to Reproduce
terraform init
terraform plan -out plan.out
terraform show -json plan.out > plan.json
Additional Information
Here is the complete plan JSON for reference:
The text was updated successfully, but these errors were encountered: