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
The project contains three layers of module call hierarchy, i.e. Root module > module.foo > module.bar, and each module contains one null_resource resource.
Root module has two providers null and null.second, and passes null.second to module.foo. module.foo calls module.bar without explicitly passing the provider, but module.bar ends up using null.second since module.foo's default null provider is null.second.
Expected Behavior
provider_config_key for all resources point to null.second in JSON output.
Actual Behavior
module.foo.module.bar.level3 points to module.foo.module.bar:null while level1 and module.foo.level2 point to null.second.
This is the actual JSON output from terraform show -json.
Steps to Reproduce
terraform init
terraform plan -out temp.out
terraform show -json temp.out > plan.json
Open plan.json
Additional Context
#30138 intended to resolve provider mappings up to the module call tree, but it seems that the current implementation only considers explicitly passed provider configurations.
This could be fixed by resolving implicitly passed default providers as well.
nozaq
changed the title
Implicitly passed default providers are not resolved to parent providers
Implicitly passed default providers are not resolved to parent provider keys in JSON output
Feb 13, 2022
At first glance I don't see an obvious way to fix this. If you do, and you'd like to submit a PR, I'll happily review it. Otherwise I'll try to find time to revisit this shortly, hopefully before Terraform 1.2 is released.
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.
Terraform Version
This issue is related to #30138, which is merged but not released yet.
Tested with the current main branch, specifically this tree.
Terraform Configuration Files
This repo contains a complete example.
Below diagram summarizes the setup.
The project contains three layers of module call hierarchy, i.e.
Root module > module.foo > module.bar
, and each module contains onenull_resource
resource.Root module has two providers
null
andnull.second
, and passesnull.second
tomodule.foo
.module.foo
callsmodule.bar
without explicitly passing the provider, butmodule.bar
ends up usingnull.second
sincemodule.foo
's default null provider isnull.second
.Expected Behavior
provider_config_key
for all resources point tonull.second
in JSON output.Actual Behavior
module.foo.module.bar.level3
points tomodule.foo.module.bar:null
whilelevel1
andmodule.foo.level2
point tonull.second
.This is the actual JSON output from
terraform show -json
.Steps to Reproduce
terraform init
terraform plan -out temp.out
terraform show -json temp.out > plan.json
plan.json
Additional Context
#30138 intended to resolve provider mappings up to the module call tree, but it seems that the current implementation only considers explicitly passed provider configurations.
This could be fixed by resolving implicitly passed default providers as well.
References
The text was updated successfully, but these errors were encountered: