minamijoyo / tfupdate

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

Fix unexpected broken parentheses expression #34

Closed minamijoyo closed 3 years ago

minamijoyo commented 3 years ago

Fixes #24

The upstream issue was fixed in hcl v2.8.0 https://github.com/hashicorp/hcl/issues/402

All we need is updating hcl to v2.8.0

[tfupdate@update-hcl-to-v2.8.0|✚2]$ cat tmp/test.tf
resource "google_container_cluster" "gke_cluster" {
  addons_config {
    network_policy_config {
      disabled = ! (length(var.gke_network_policy) > 0 && var.gke_network_policy[0].enabled)
    }
  }
}

[tfupdate@update-hcl-to-v2.8.0|✚2]$ go run main.go terraform tmp/test.tf

[tfupdate@update-hcl-to-v2.8.0|✚2]$ cat tmp/test.tf
resource "google_container_cluster" "gke_cluster" {
  addons_config {
    network_policy_config {
      disabled = ! (length(var.gke_network_policy) > 0 && var.gke_network_policy[0].enabled)
    }
  }
}