-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configs: Emit warnings for deprecated quoted references/keywords
Terraform 0.12.0 removed the need for putting references and keywords in quotes, but we disabled the deprecation warnings for the initial release in order to avoid creating noise for folks who were intentionally attempting to maintain modules that were cross-compatible with both Terraform 0.11 and Terraform 0.12. However, with Terraform 0.12 now more widely used, the lack of these warnings seems to be causing newcomers to copy the quoted versions from existing examples on the internet, which is perpetuating the old and confusing quoted form in newer configurations. In preparation for phasing out these deprecated forms altogether in a future major release, and for the shorter-term benefit of giving better feedback to newcomers when they are learning from outdated examples, we'll now re-enable those deprecation warnings, and be explicit that the old forms are intended for removal in a future release. In order to properly test this, we establish a new set of test configurations that explicitly mark which warnings they are expecting and verify that they do indeed produce those expected warnings. We also verify that the "success" tests do _not_ produce warnings, while removing the ones that were previously written to succeed but have their warnings ignored.
- Loading branch information
1 parent
89dbb52
commit de652e2
Showing
12 changed files
with
117 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
configs/testdata/valid-files/resources-ignorechanges-all-legacy.tf
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
configs/testdata/valid-files/resources-ignorechanges-all-legacy.tf.json
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
configs/testdata/valid-files/resources-ignorechanges-quoted.tf
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
configs/testdata/valid-files/resources-provisioner-onfailure-quoted.tf
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
configs/testdata/valid-files/resources-provisioner-when-quoted.tf
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "null_resource" "a" { | ||
} | ||
|
||
resource "null_resource" "b" { | ||
depends_on = ["null_resource.a"] # WARNING: Quoted references are deprecated | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
provider "null" { | ||
alias = "foo" | ||
} | ||
|
||
resource "null_resource" "test" { | ||
provider = "null.foo" # WARNING: Quoted references are deprecated | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "null_resource" "a" { | ||
provisioner "local-exec" { | ||
when = "create" # WARNING: Quoted keywords are deprecated | ||
on_failure = "fail" # WARNING: Quoted keywords are deprecated | ||
} | ||
} |