node_selector = “NODEGROUP2”
And it works correctly.
Tflint is now throwing a warning on it as below,
Warning: Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)
Trying to understand what exactly its throwing warning and possible fixes?
Is it complaining on “${}” and I have to set to set it as var.node_group ?
Sorry edited the post.
var.key within {} will throw terraform plan error
“var.key” within {} wont error, but value for var.key wont get replaced.
(var.key) within {} worked well.
It is not normal to have to use parentheses when dealing with an ‘interpolation-only expressions’ warning - however this is a special case because it is specifically in the context of an object key.
Indeed… this is a special exception in the language grammar because the most common situation is to write literal object attribute names, whereas a dynamic attribute name based on a reference to something else is less common.
For that reason, in this situation Terraform will treat an identifier there as a literal attribute name be default, but allows using other expression types as long as it isn’t ambiguous whether a literal name or reference was intended. Adding parentheses is one way to remove the ambiguity without changing the meaning of the expression, and so IIRC the error message for this situation recommends using parenthesis as shown above.