-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
"panic: inconsistent list element types" when using optional object attributes across multiple modules #31844
Comments
Thanks for the report! I'm able to reproduce the crash, and I'm looking into the cause. |
A smaller reproduction: main.tf: variable "configs" {
type = list(object({
a = optional(set(string))
}))
default = [
{ a = ["boop"] },
{},
]
}
module "child" {
source = "./child"
configs = var.configs
} child/main.tf: variable "configs" {
type = list(object({
a = optional(set(string), [])
}))
} Same crash:
|
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. |
Terraform Version
Terraform Configuration Files
Root module:
my_module:
my_submodule:
Debug Output
https://gist.github.com/hanneshayashi/fe9e91f2254f733a3cd3e57239bec856
Expected Behavior
Terraform doesn't crash.
Actual Behavior
Terraform crashes.
Steps to Reproduce
terraform init
terraform plan
Additional Context
It seems like Terraform 1.3.0 has a problem with optional attributes in lists of objects. We have multiple nested modules and we were using the experimental feature until now.
Since I can no longer use the
default()
function, I need to declare my variable in the "lowest" submodule like so:Since I don't want to declare the defaults in all modules that use the submodule I declare the variable like so:
When I then call the first module with two differently constructed objects Terraform crashes:
Removing either of the objects prevents the crash.
References
No response
The text was updated successfully, but these errors were encountered: