Skip to content

Commit

Permalink
Add tests for conditions not known until the apply step
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Dec 25, 2024
1 parent b95683e commit 57698a8
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ jobs:
with:
tf_path: tests/pass-output

- name: Initialize - Pass - Delayed
id: init-pass-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/pass-delayed
- name: Run Tests - Pass - Delayed
id: tests-pass-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/pass-delayed

- name: Initialize - Fail
id: init-fail
uses: Invicton-Labs/terraform-module-testing/[email protected]
Expand All @@ -70,6 +81,17 @@ jobs:
with:
tf_path: tests/fail-output

- name: Initialize - Fail - Delayed
id: init-fail-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/fail-delayed
- name: Run Tests - Fail - Delayed
id: tests-fail-delayed
uses: Invicton-Labs/terraform-module-testing/[email protected]
with:
tf_path: tests/fail-delayed

# This job just waits for all other jobs to pass. We have it here
# so our branch protection rule can reference a single job, instead
# of needing to list every matrix value of every job above.
Expand Down
22 changes: 22 additions & 0 deletions tests/fail-delayed/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/fail-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module "fail" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() == ""
error_message = "sample error"
}
22 changes: 22 additions & 0 deletions tests/pass-delayed/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/pass-delayed/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module "pass" {
source = "../../"
// Use a condition that isn't known until the apply step
condition = uuid() != ""
error_message = "sample error"
}

0 comments on commit 57698a8

Please sign in to comment.