-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: Edit object type #28
Comments
The
However, The type of |
Thanks. For completeness, my use case is:
Trying to extract (and set) the value of locals.prod_1.vpc0.ram_subnets.a0.cidr_block |
The hcledit depends on the If your concern is only query (not edit), the best way to do this for now is convert it to json with hcl2json and query the json string with jq. https://github.com/tmccombs/hcl2json
|
So if I read this correctly, we couldn't add, for example, a tags block into an AWS resource:
although actually:
seems to return the string. And I can set it with
so as long as you don't mind replacing the whole block you can do so? |
Thank you for pointing out it. The hcledit uses a token based parser and actually doesn't know what type is correct in application schema, so you can set an object literal as a string. |
One way to work around this for now is to recursively feed attribute blocks back into hcledit as intermediate locals blocks
locals {
map = {
key = "foo"
}
} Normally locals.map is returned as
Can get the above output to look like a locals block of a new intermediate tf file and to then select the next nested key
This can be implemented recursively to get (and even set) deeply nested attributes of locals, resources, modules, etc |
I have the following HCL file:
And receive the following outputs:
No results are returned for locals.workload_1. Not sure why. Thanks!
The text was updated successfully, but these errors were encountered: