Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 64cf53b into backport/alisdair/check-block-missing-condition/gr…
…eatly-key-chamois
- Loading branch information
Showing
3 changed files
with
69 additions
and
19 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
29 changes: 29 additions & 0 deletions
29
internal/configs/testdata/invalid-files/precondition-postcondition-badref.tf
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,29 @@ | ||
data "example" "example" { | ||
foo = 5 | ||
|
||
lifecycle { | ||
precondition { | ||
condition = data.example.example.foo == 5 # ERROR: Invalid reference in precondition | ||
error_message = "Must be five." | ||
} | ||
postcondition { | ||
condition = self.foo == 5 | ||
error_message = "Must be five, but is ${data.example.example.foo}." # ERROR: Invalid reference in postcondition | ||
} | ||
} | ||
} | ||
|
||
resource "example" "example" { | ||
foo = 5 | ||
|
||
lifecycle { | ||
precondition { | ||
condition = example.example.foo == 5 # ERROR: Invalid reference in precondition | ||
error_message = "Must be five." | ||
} | ||
postcondition { | ||
condition = self.foo == 5 | ||
error_message = "Must be five, but is ${example.example.foo}." # ERROR: Invalid reference in postcondition | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
internal/configs/testdata/invalid-files/precondition-postcondition-missing-condition.tf
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,12 @@ | ||
resource "example" "example" { | ||
foo = 5 | ||
|
||
lifecycle { | ||
precondition { # ERROR: Missing required argument | ||
error_message = "Can a check block fail without a condition?" | ||
} | ||
postcondition { # ERROR: Missing required argument | ||
error_message = "Do not try to pass the check; only realize that there is no check." | ||
} | ||
} | ||
} |