-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't workingpreservedPreserved issues never go stalePreserved issues never go stale
Description
Describe the bug
When using include in Terragrunt with shallow merge (the default), the terraform { include_in_copy / exclude_from_copy } lists are not merged correctly:
- If both parent and child define lists, the parent values override the child values, even though shallow merge semantics are supposed to let the child win.
- If the parent has
nillists but the child defines them, the child’s values are still dropped.
This makes it impossible to set include_in_copy / exclude_from_copy in child configs.
Deep merge works as expected (lists are concatenated, parent first then child). This issue is only about shallow merge.
Steps To Reproduce
Folder structure
repo-root/
├── shared/
│ └── parent.hcl # parent config
└── app/
└── terragrunt.hcl # child config
Parent (shared/tf_provider_azapi.hcl)
terraform {
source = "git::ssh://[email protected]/example/repo//modules/tf-module"
# no include_in_copy or exclude_from_copy here
}Child (app/terragrunt.hcl)
include "parent" {
path = find_in_parent_folders("shared/parent.hcl")
# default merge_strategy = "shallow"
}
terraform {
exclude_from_copy = ["**/_*"]
}Current Behavior (Bug)
The child’s exclude_from_copy is dropped.
The effective config is just:
terraform {
source = "git::ssh://[email protected]/example/repo//modules/azapi"
}Expected behavior
In shallow merge, the child’s values should override the parent’s if non-nil:
terraform {
source = "git::ssh://[email protected]/example/repo//modules/tf-module"
exclude_from_copy = ["**/_*"]
}Nice to haves
- Terminal output
- Screenshots
Versions
- Terragrunt version: (tested on v0.86.2)
- OpenTofu/Terraform version: (e.g. Tofu v1.10.5)
- Environment details: (e.g. macOS 15.6.1)
Additional context
- This issue only affects shallow merge. Deep merge already works correctly (covered by tests).
- Currently forces duplication of
terraform.sourcein parent configs to make filters work, which breaks DRY usage. - Inconsistent with documented shallow-merge behaviour where child overrides parent for simple attributes.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpreservedPreserved issues never go stalePreserved issues never go stale