hcledit icon indicating copy to clipboard operation
hcledit copied to clipboard

Unable to get/set attributes more than 4 levels deep

Open maksym-sereda opened this issue 2 years ago • 2 comments

Hi, I'm trying to set attribute in the following file

data "terraform_remote_state" "state" {
  config = {
    workspaces = {
      name = "tt-test"
    }
  }
}

but without the luck. No output there. The command I used was cat ./remote-states.tf | /scripts/hcledit attribute get data.terraform_remote_state.state.config.workspaces.name The only thing I could get is

> cat ./remote-states.tf | /scripts/hcledit attribute get data.terraform_remote_state.state.config
{
    workspaces = {
      name = "tt-test"
    }
  }

Is it possible to do by hcledit?

maksym-sereda avatar Jun 15 '22 11:06 maksym-sereda

Any response will be appreciated

maksym-sereda avatar Jun 20 '22 10:06 maksym-sereda

I think this is answered here:

https://github.com/minamijoyo/hcledit/issues/44#issuecomment-1040292871

In the HCL specification, foo {} is a block and foo = {} is an attribute with an object type. Note that = means the attribute syntax. With that in mind, a hypothetical address notation could be terraform.required_providers.aws["version"]

However, the address index reference notation has not been implemented yet due to technical limitations of the hclwrite package in the upstream hcl library we depends on.

Looking for the same thing.

jurgen-weber-deltatre avatar Jul 05 '22 02:07 jurgen-weber-deltatre

Closed this as duplicate of #44, which is also closed as duplicate of #28.

minamijoyo avatar Jan 05 '23 02:01 minamijoyo