minamijoyo / tfupdate

Update version constraints in your Terraform configurations
MIT License
556 stars 23 forks source link

Fix panic with legacy dot access of numeric indexes #19

Closed minamijoyo closed 4 years ago

minamijoyo commented 4 years ago

Fixes #18

This issue caused by hclwrite library and it has been already fixed in upstream. https://github.com/hashicorp/hcl/pull/369

So the fix is only updating hcl to the latest(v2.6.0). I confirmed that now I can parse the configuration in #18 with no errors.

$ cat tmp/test.tf
locals {
  name = kubernetes_namespace.my_conditional_namespaces.metadata.0.name
}

[tfupdate@fix-panic-with-legacy-dot-access|✔]$ bin/tfupdate terraform tmp/test.tf

[tfupdate@fix-panic-with-legacy-dot-access|✔]$ echo $?
0