Skip to content

Commit

Permalink
Upgrade ignore_changes wildcard from warning to error
Browse files Browse the repository at this point in the history
The syntax ignore_changes = ["*"] was deprecated and now errors.
Use = all instead.
  • Loading branch information
pselle committed Feb 19, 2021
1 parent 3da5d2b commit 230658f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
6 changes: 3 additions & 3 deletions configs/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions configs/testdata/error-files/ignore_changes.tf
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
resource "null_resource" "all" {
lifecycle {
ignore_changes = ["*"] # ERROR: Invalid ignore_changes wildcard
}
}
11 changes: 0 additions & 11 deletions configs/testdata/warning-files/ignore_changes.tf

This file was deleted.

4 changes: 2 additions & 2 deletions terraform/context_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 2,6 @@ resource "aws_instance" "foo" {
required_field = "set"

lifecycle {
ignore_changes = ["*"]
ignore_changes = all
}
}

0 comments on commit 230658f

Please sign in to comment.