If a nested sub-module - two modules deep - has a variable with a misspelled attribute, configs will return a module call with no module config. terraform init|plan|apply have no problem with this, but it caused a crash in terraform show -json. It is also of note that terraform validate does not catch this (from the top-level directory) as it does not follow nested modules.
If this isn't causing problems elsewhere it might not be worth changing the behavior; I am opening this issue to capture my findings. My primary concern is for sentinel users.
Terraform Version
Terraform Configuration Files
$ tree
.
├── main.tf
├── modules
│ ├── main.tf
│ └── more
│ └── main.tf
main.tf:
module "my_module" {
source = "./modules"
}
./modules/main.tf:
module "nested_module" {
source = "./more"
}
./modules/more/main.tf:
variable "misspelled" {
default = "hiya"
descriptini = "this attribute is misspelled"
}
Expected Behavior
The config loader should either put a placeholder empty body in there, or leave out the ModuleCall entirely, or similar.
Actual Behavior
config was nil
Steps to Reproduce
terraform show -json tf.plan
Additional Context
init and plan all run successfully.
References
#21543
If a nested sub-module - two modules deep - has a variable with a misspelled attribute,
configswill return a module call with no module config.terraform init|plan|applyhave no problem with this, but it caused a crash interraform show -json. It is also of note thatterraform validatedoes not catch this (from the top-level directory) as it does not follow nested modules.If this isn't causing problems elsewhere it might not be worth changing the behavior; I am opening this issue to capture my findings. My primary concern is for sentinel users.
Terraform Version
Terraform Configuration Files
main.tf:./modules/main.tf:./modules/more/main.tf:Expected Behavior
The config loader should either put a placeholder empty body in there, or leave out the
ModuleCallentirely, or similar.Actual Behavior
config was nil
Steps to Reproduce
terraform show -json tf.planAdditional Context
initandplanall run successfully.References
#21543