generated from terraform-linters/tflint-ruleset-template
-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Follow up of #184
The terraform_deprecated_interpolation
rule may produce ambiguous attribute keys if the map key contains a deprecated interpolation.
$ cat main.tf
variable "foo" {}
locals {
tags = {
"${var.foo}" = "bar"
}
}
$ terraform validate
Success! The configuration is valid.
$ tflint --fix --only terraform_deprecated_interpolation
1 issue(s) found:
Warning: [Fixed] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)
on main.tf line 5:
5: "${var.foo}" = "bar"
Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.7.0/docs/rules/terraform_deprecated_interpolation.md
$ cat main.tf
variable "foo" {}
locals {
tags = {
var.foo = "bar"
}
}
$ terraform validate
terraform validate
╷
│ Error: Ambiguous attribute key
│
│ on main.tf line 5, in locals:
│ 5: var.foo = "bar"
│
│ If this expression is intended to be a reference, wrap it in parentheses. If it's instead intended as a literal name containing periods, wrap it in quotes to create
│ a string literal.
This is probably an autofix bug; it should produce (var.foo)
. Instead of always removing "${}"
, we should probably implement context-sensitive autofix.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working