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
The code is working here as expected, because equality always compares precise types first, and you have not created an object of the same type. The object literal in your condition has the type:
which is not going to match the. There are no default values, because you are not passing a value into the input variable, which is where the type constraint with the defaults is defined. The only way to get the exact same type conversion right now would be to create a module with the same type constraints and pass the value through for comparison. In general it's more reliable to compare the attributes you want directly rather than as a group in nested literals.
We do have open enhancement requests already for easier inline type conversions, like #23562, #26164, #27643, etc.
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
main.tf
main.tftest.hcl
Debug Output
terraform console
terraform test
Expected Behavior
The test is passing.
Actual Behavior
The test fails. An issue arises if a nested object or map of objects has a null value. In the case of assigning the
size
attribute test is passing.Updated variables block:
Update assert block:
Steps to Reproduce
terraform test
Additional Context
No response
References
No response
The text was updated successfully, but these errors were encountered: