Summary:
Failed to parse file if a map index is a variable reference
Version:
$ tfupdate --version
0.3.2
Expected behavior:
no error
Actual behavior:
panic
Step to reproduce:
- Given the following file:
tmp/test.tf
variable "a" {
default = {
dev = 1
prod = 2
}
}
variable "env" {
default = "dev"
}
resource "hoge" "fuga" {
b = a[var.env]
}
- Run tfupdate
$ tfupdate terraform ./tmp/test.tf
failed to parse input: ./tmp/test.tf
panic: didn't find any token of type TokenIdent
This may be caused by a bug in the hclwrite parser.
As a workaround, you can ignore this file with --ignore-path option