mattolenik / hclq

Command-line processor for HashiCorp config files, like sed for HCL — Terraform, Consul, Nomad, Vault
https://hclq.sh
The Unlicense
254 stars 23 forks source link

Fix no set on empty list #3

Closed LudovicTOURMAN closed 5 years ago

LudovicTOURMAN commented 6 years ago

Using this terraform sample bar.tf:

module "bar" {
  source = "../modules/foo"
  my_list = []
}

Running command cat bar.tf | hclq set 'module.bar.my_list[]' '["foo","bar"]' will result in not changing the value in the file/output.

This is caused by the fact that list is empty and we don't return a Result struct containing the concerned ast.Node

mattolenik commented 5 years ago

No longer needed as a result of redesign/refactoring (as talked about in the issue). Thank you again for the PR and sorry for the late response! I'm paying more attention now that I've realized people are actually using this tool! 🤸‍♂️