Merge pull request #27834 from hashicorp/pselle/ignore-changes-wildcard

Upgrade ignore_changes wildcard from warning to error
This commit is contained in:
Pam Selle 2021-02-19 16:16:39 -05:00 committed by GitHub
commit 61bee3cd44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 17 deletions

View File

@ -204,9 +204,9 @@ func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
r.Managed.IgnoreAllChanges = true
ignoreAllRange = expr.Range()
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Deprecated ignore_changes wildcard",
Detail: "The [\"*\"] form of ignore_changes wildcard is deprecated. Use \"ignore_changes = all\" to ignore changes to all attributes.",
Severity: hcl.DiagError,
Summary: "Invalid ignore_changes wildcard",
Detail: "The [\"*\"] form of ignore_changes wildcard is was deprecated and is now invalid. Use \"ignore_changes = all\" to ignore changes to all attributes.",
Subject: attr.Expr.Range().Ptr(),
})
continue

View File

@ -0,0 +1,5 @@
resource "null_resource" "all" {
lifecycle {
ignore_changes = ["*"] # ERROR: Invalid ignore_changes wildcard
}
}

View File

@ -1,11 +0,0 @@
resource "null_resource" "one" {
lifecycle {
ignore_changes = ["triggers"] # WARNING: Quoted references are deprecated
}
}
resource "null_resource" "all" {
lifecycle {
ignore_changes = ["*"] # WARNING: Deprecated ignore_changes wildcard
}
}

View File

@ -8372,8 +8372,8 @@ func TestContext2Apply_ignoreChangesWithDep(t *testing.T) {
}
}
func TestContext2Apply_ignoreChangesWildcard(t *testing.T) {
m := testModule(t, "apply-ignore-changes-wildcard")
func TestContext2Apply_ignoreChangesAll(t *testing.T) {
m := testModule(t, "apply-ignore-changes-all")
p := testProvider("aws")
p.PlanResourceChangeFn = testDiffFn
p.ApplyResourceChangeFn = testApplyFn

View File

@ -2,6 +2,6 @@ resource "aws_instance" "foo" {
required_field = "set"
lifecycle {
ignore_changes = ["*"]
ignore_changes = all
}
}