mercari / hcledit

Go package to edit HCL configuration
MIT License
44 stars 13 forks source link

[feature] Indexing #119

Open ryan-ph opened 2 months ago

ryan-ph commented 2 months ago

Currently there is no support for indexing on a list. Ideally we should be able to query and write to specific objects within a list. For example, if we have the following HCL file:

# attrs.tf
attribute = ["str1", "str2", "str3"]

I would expect the following query to work and return the following result:

$ hcledit read -o go-template="{{.Value}}" "attribute[1]" attrs.tf
str2