-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Using merge on a variable that is null results in a panic #21695
Comments
In this case it looks like the map itself is what is Curiously, I see that this function is explicitly opting in to receiving nulls, but then failing to handle them. The easiest fix here would be to remove While in principle ignoring the null values altogether could be a reasonable behavior, elsewhere in the language we've tended towards being explicit about treating null as distinct from an empty value because it tends to make it easier to catch mistakes where something is mistakenly unset. I suggest that we stick with that principle here and make this an error; in line with our usual "explicit is better than implicit" principle, there is an explicit way to indicate the behavior of treating a null as if it were an empty map: coalesce(var.iam_role_tags, {}) |
Just filling the gaps Terraform version
Terraform Configuration Files
test.tf
Default:./terraform-0.12.1 apply
data.null_data_source.values: Refreshing state...
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
value_from_null_data_source = some_value With
|
closed by #21734 |
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. |
Relocating from this comment: #5471 (comment)
Terraform Version
Terraform Configuration Files
...
Debug Output
Crash Output
Expected Behavior
Omit the null values
Actual Behavior
A panic!
Steps to Reproduce
Additional Context
References
The text was updated successfully, but these errors were encountered: