-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Currently the library only supports merging hcl Blocks and nested Blocks recursively. When it comes to attributes (in setAttrs
), this is all or nothing, which means both objects and arrays are replaced entirely w/o attempting to merge.
Attributes are represented as a list of hcl Tokens, so in order to merge attributes, we need to be able to parse the list of Tokens to make sense of the type of value we are dealing with.
Acceptance criteria:
- Be able to recursively merge nested objects
- Any MR should have this (or a similar) test case added to
hcl_test.go
:
tests := []struct {
name string
input input
want string
wantErr error
}{
{
name: "merge nested duplicate",
input: input{
a: `module "b" {
c = {
"foo" = {
value = 1
},
}
}
`,
b: `module "b" {
c = {
"bar" = {
value = 2
},
}
}
`,
},
want: `module "b" {
c = {
"foo" = {
value = 1
},
"bar" = {
value = 2
},
}
}
`,
},
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers