From df6dad5070db77fe55de8b40348d3c181c9dd000 Mon Sep 17 00:00:00 2001 From: Katy Moe Date: Mon, 1 Nov 2021 19:00:54 +0000 Subject: [PATCH] add failing test for IgnoreAllChanges override --- internal/configs/module_merge_test.go | 10 ++++++++++ .../valid-modules/override-ignore-changes/main.tf | 3 +++ .../override-ignore-changes/main_override.tf | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 internal/configs/testdata/valid-modules/override-ignore-changes/main.tf create mode 100644 internal/configs/testdata/valid-modules/override-ignore-changes/main_override.tf diff --git a/internal/configs/module_merge_test.go b/internal/configs/module_merge_test.go index d95e62c3c..b5d7fb368 100644 --- a/internal/configs/module_merge_test.go +++ b/internal/configs/module_merge_test.go @@ -320,3 +320,13 @@ func TestModuleOverrideResourceFQNs(t *testing.T) { t.Fatalf("wrong result: found provider config ref %s, expected nil", got.ProviderConfigRef) } } + +func TestModuleOverrideIgnoreAllChanges(t *testing.T) { + mod, diags := testModuleFromDir("testdata/valid-modules/override-ignore-changes") + assertNoDiagnostics(t, diags) + + r := mod.ManagedResources["test_instance.foo"] + if !r.Managed.IgnoreAllChanges { + t.Fatalf("wrong result: expected r.Managed.IgnoreAllChanges to be true") + } +} diff --git a/internal/configs/testdata/valid-modules/override-ignore-changes/main.tf b/internal/configs/testdata/valid-modules/override-ignore-changes/main.tf new file mode 100644 index 000000000..55ae5151d --- /dev/null +++ b/internal/configs/testdata/valid-modules/override-ignore-changes/main.tf @@ -0,0 +1,3 @@ +resource "test_instance" "foo" { + foo = "bar" +} diff --git a/internal/configs/testdata/valid-modules/override-ignore-changes/main_override.tf b/internal/configs/testdata/valid-modules/override-ignore-changes/main_override.tf new file mode 100644 index 000000000..f9cd9a5d3 --- /dev/null +++ b/internal/configs/testdata/valid-modules/override-ignore-changes/main_override.tf @@ -0,0 +1,6 @@ +resource "test_instance" "foo" { + foo = "bar" + lifecycle { + ignore_changes = all + } +}