Upgrade ignore_changes wildcard from warning to error

The syntax ignore_changes = ["*"] was deprecated and now errors.
Use = all instead.
This commit is contained in:
Pam Selle 2021-02-19 10:19:27 -05:00
parent 3da5d2bdf6
commit 230658f2b2
5 changed files with 11 additions and 17 deletions

View File

@ -211,9 +211,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
}
}