Closed steini44as closed 1 year ago
Hi @steini44as,
Terraform decodes and validates the configuration as a whole before applying any of the specific configuration values. Since this is a known type violation, the validation process catches the error and reports it correctly. Because not all values can be known during validation, Terraform does not make any assumptions about how modules will be expanded, and all configuration is processed. The only way to fully remove a module from being evaluated is to remove it from the configuration.
Since Terraform is working as designed here, and this does not represent a bug in the CLI, I'm going to close this out. We use GitHub issues for tracking bugs and enhancements, rather than for questions. While we can sometimes help with certain simple problems here, it's better to use the community forum where there are more people ready to help.
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. 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
Terraform Configuration Files
Debug Output
none
Expected Behavior
If VirtualNetworkHubObject is empty, it shouldn't error/evaluate the ResourceName, ResourceGroupName etc).
Actual Behavior
Error: Unsupported attribute │ │ on main.tf line 54, in module "virtual_network_hub": │ 54: ResourceName = local.var_config.VirtualNetworkHubObject.VirtualNetworkName │ ├──────────────── │ │ local.var_config.VirtualNetworkHubObject is object with no attributes │ │ This object does not have an attribute named "VirtualNetworkName".
Now it tries to look for VirtualNetworkName inside the VirtualNetworkHubObject object.
Steps to Reproduce
Additional Context
No response
References
No response