Skip to content

Commit fe2a5e8

Browse files
authored
Merge pull request #29851 from hashicorp/backport/kmoe/ignore_changes-override/suitably-crucial-hen
Backport of configs: fix ignore_changes config override bug into v1.0
2 parents 34d6ef6 + 0fe851e commit fe2a5e8

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

internal/configs/configschema/validate_traversal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
// diagnostics if any problems are found.
1818
//
1919
// This method is "optimistic" in that it will not return errors for possible
20-
// problems that cannot be detected statically. It is possible that an
20+
// problems that cannot be detected statically. It is possible that a
2121
// traversal which passed static validation will still fail when evaluated.
2222
func (b *Block) StaticValidateTraversal(traversal hcl.Traversal) tfdiags.Diagnostics {
2323
if !traversal.IsRelative() {

internal/configs/module_merge.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ func (r *Resource) merge(or *Resource, rps map[string]*RequiredProvider) hcl.Dia
227227
if len(or.Managed.IgnoreChanges) != 0 {
228228
r.Managed.IgnoreChanges = or.Managed.IgnoreChanges
229229
}
230+
if or.Managed.IgnoreAllChanges {
231+
r.Managed.IgnoreAllChanges = true
232+
}
230233
if or.Managed.PreventDestroySet {
231234
r.Managed.PreventDestroy = or.Managed.PreventDestroy
232235
r.Managed.PreventDestroySet = or.Managed.PreventDestroySet

internal/configs/module_merge_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,13 @@ func TestModuleOverrideResourceFQNs(t *testing.T) {
315315
t.Fatalf("wrong result: found provider config ref %s, expected nil", got.ProviderConfigRef)
316316
}
317317
}
318+
319+
func TestModuleOverrideIgnoreAllChanges(t *testing.T) {
320+
mod, diags := testModuleFromDir("testdata/valid-modules/override-ignore-changes")
321+
assertNoDiagnostics(t, diags)
322+
323+
r := mod.ManagedResources["test_instance.foo"]
324+
if !r.Managed.IgnoreAllChanges {
325+
t.Fatalf("wrong result: expected r.Managed.IgnoreAllChanges to be true")
326+
}
327+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
resource "test_instance" "foo" {
2+
foo = "bar"
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resource "test_instance" "foo" {
2+
foo = "bar"
3+
lifecycle {
4+
ignore_changes = all
5+
}
6+
}

0 commit comments

Comments
 (0)