-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(terraform): set null value as fallback for missing variables #7669
fix(terraform): set null value as fallback for missing variables #7669
Conversation
1446748
to
0b6dcd4
Compare
@nikpivkin tests are red due to the rate limit issue, it lgtm, should we merge it? |
thanks for your contribution, @albertodonato |
Hi @albertodonato ! I'm wondering what problem this solves. Do you have an example? variable "v" {
type = string
}
locals {
l = ["foo", var.v]
d = {"foo": var.v}
} In the configuration above, |
@nikpivkin as mentioned above, in my test without this change, the locals would get set to null because the variable is unknown, whereas with this change you at least get the expected type (list, map) with null values. |
FWIW similar behavior happens with |
@simar7 I restarted the tests and they passed |
The value does not become null if one of the elements is unknown. I have given an example above. |
If you revert my change the added test fails on the |
@nikpivkin would it be possible to merge this, or is something needed on my side? |
@simar7 can you take a look? |
Description
This adds a default null value for variables that don't get a value (either supplied or default).
It allows expressions using those variables to be evaluated, rather than just be set to null.
E.g
would produce
l = ["foo" null]
andd = {"foo": null}
rather than just being bothnull
.Checklist