mattolenik/hclq

`set` command is not working if terraform list is empty (Available PR)

LudovicTOURMAN opened this issue · 3 comments

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

Here is the corresponding pull request to fix the issue :
#3

Hey, thank you for the PR, and sorry for the crazy late response! I didn't have time to maintain this project for a little while but it recently underwent a huge refactor. This and other, similar issues should all be fixed now. I'm sorry I didn't notice your PR sooner :( but it is appreciated!

Hi Matt,

Thanks for the answer. I'll have a look to the refacto ;)