You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before validating variable value, the default value should be set as it's value, because the variable is tagged as nullable = false.
In the docs it's written that: Setting nullable to false ensures that the variable value will never be null within the module. If nullable is false and the variable has a default value, then Terraform uses the default when a module input argument is null.
Actual Behavior
In cases where input variable has nullable argument set to false and the value passed to the variable is null, the validated value is null instead of the default value.
Steps to Reproduce
terraform init
terraform plan/apply
Additional context
I know there are workarounds for this problem, but shouldn't the default value be inserted into validation condition, because the default value will be used further in the module and not the null?
The text was updated successfully, but these errors were encountered:
jbardin
added
config
confirmed
a Terraform Core team member has reproduced this issue
v1.1
Issues (primarily bugs) reported against v1.1 releases
and removed
new
new issue not yet triaged
labels
Jan 6, 2022
Thanks for filing the issue. This does appear to be unintended behavior related to the new nullable option in combination with the validation rules.
What appears to be happening is that the validation rules (or really the language in general) never had the possibility of ensuring a non-nullable value before, so any condition must have been able to handle a null value. Now that a variable has a way to ensure the value is never null, we also need to pass that constraint into the validation logic.
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
Module:
Debug Output
Expected Behavior
Before validating variable value, the default value should be set as it's value, because the variable is tagged as
nullable = false
.In the docs it's written that:
Setting nullable to false ensures that the variable value will never be null within the module. If nullable is false and the variable has a default value, then Terraform uses the default when a module input argument is null.
Actual Behavior
In cases where input variable has
nullable
argument set tofalse
and the value passed to the variable isnull
, the validated value isnull
instead of the default value.Steps to Reproduce
Additional context
I know there are workarounds for this problem, but shouldn't the default value be inserted into validation condition, because the default value will be used further in the module and not the
null
?The text was updated successfully, but these errors were encountered: