Skip to content

Failed to parse file if a map index is a variable reference #12

@minamijoyo

Description

@minamijoyo

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:

  1. 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]
}
  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions