Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested values in a module doesn't work #92

Open
jrobison-sb opened this issue Feb 9, 2024 · 2 comments
Open

nested values in a module doesn't work #92

jrobison-sb opened this issue Feb 9, 2024 · 2 comments

Comments

@jrobison-sb
Copy link

This example file:

$ cat /tmp/attr.hcl 

# This resource is pasted directly from the hcledit readme
resource "foo" "bar" {
  attr1 = "val1"
  nested {
    attr2 = "val2"
  }
}

# And I expect this module to work with nesting the same way as the above resource
module "foo" {
  nested = {
    attr2 = "val2"
  }
}

Retrieving a nested value from the resource works as expected:

$ cat /tmp/attr.hcl | hcledit attribute get resource.foo.bar.nested.attr2
"val2"

But retrieving a similary nested value from the module doesn't work:

$ cat /tmp/attr.hcl | hcledit attribute get module.foo.nested.attr2
[no output at all]

Note that I can get the nested map, I just can't seem to recurse inside it:

$ cat /tmp/attr.hcl | hcledit attribute get module.foo.nested
{
    attr2 = "val2"
  }
$ hcledit version
0.2.10
# On an Apple Silicon Macbook, if that matters
@nikpivkin
Copy link

Hi @jrobison-sb

This is not an issue with the module. attr2 is an nested map field, not an attribute. It will also not work for resources, for example:

cat ./test/main.tf
resource "foo" "bar" {
  attr1 = "val1"
  nested = {
    attr2 = "val2"
  }
}%

cat ./test/main.tf| ./hcledit attribute get resource.foo.bar.nested.attr2

@ilia-faraway
Copy link

Terragrunt inputs are also defined as a map fields https://terragrunt.gruntwork.io/docs/features/inputs/, and it will be very handy to manipulate them. It will be great to have such a functionality!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants