feature: Add deep_merge HCL function for deep map/object input merging#5535
feature: Add deep_merge HCL function for deep map/object input merging#5535EvansM4 wants to merge 4 commits intogruntwork-io:mainfrom
Conversation
|
@EvansM4 is attempting to deploy a commit to the Gruntwork Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new Terragrunt HCL built-in function Changes
Sequence Diagram(s)sequenceDiagram
participant Parser as HCL Parser
participant Eval as Eval Context
participant Func as deep_merge Function
participant Merge as Merge Logic
participant Result as Cty Value
Parser->>Eval: Parse HCL invoking deep_merge(...)
Eval->>Func: Call deepMergeMapValuesAsFuncImpl with args
Func->>Func: Iterate args, skip nulls, validate map/object types
alt Invalid type detected
Func->>Result: Return InvalidParameterTypeError
else All args valid
Func->>Merge: Provide validated maps/values
Merge->>Merge: Recursively merge maps (later overrides)
Merge->>Merge: Append list values
Merge->>Result: Return merged cty.Value
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@yhakbar would you mind reviewing this when you get a chance, I do realise that adding new features prior to the 1.0 release would likely not happen. |
docs-starlight/src/content/docs/04-reference/01-hcl/04-functions.mdx
Outdated
Show resolved
Hide resolved
docs-starlight/src/content/docs/04-reference/01-hcl/04-functions.mdx
Outdated
Show resolved
Hide resolved
yhakbar
left a comment
There was a problem hiding this comment.
Hey @EvansM4 ,
I don't see anything seriously wrong with this function, but we are in a feature freeze pending release of 1.0. I'm going to move this PR in-draft to signal that. I imagine we'll also need to rebase the PR once we've released 1.0, as main will have moved quite a bit.
Thanks for opening this! Looking forward to reviewing it again after 1.0. Please mark as ready for review and tag maintainers until it's reviewed after 1.0.
# Conflicts: # pkg/config/config_helpers.go
Implements #4820
Add a new Terragrunt HCL function, deep_merge(...), to support deep merging of map/object inputs (including decoded JSON objects) this works similar to the existing merge(...) function behavior but provides deep merging.
Changes included:
TODOs
Read the Gruntwork contribution guidelines (https://gruntwork.notion.site/Gruntwork-Coding-Methodology-02fdcd6e4b004e818553684760bf691e).
Release Notes (draft)
Added deep_merge(...) Terragrunt HCL function for deep map/object merging
Migration Guide
No migration required. This is additive and does not change existing merge(...) behaviour.
Summary by CodeRabbit
New Features
Documentation
Tests