Skip to content

Commit

Permalink
Update version, add tests for forced output checking
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Dec 25, 2024
1 parent 25723ab commit b95683e
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 2 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
id: matrix
uses: Invicton-Labs/terraform-module-testing/matrix@v0.2.0
with:
minimum_tf_version: '1.9.0'
minimum_tf_version: '1.10.3'

- name: Output Matrix
run: |
Expand All @@ -37,6 +37,17 @@ jobs:
with:
tf_path: tests/pass

- name: Initialize - Pass (With Output)
id: init-pass-output
uses: Invicton-Labs/terraform-module-testing/initialize@v0.2.0
with:
tf_path: tests/pass-output
- name: Run Tests - Pass (With Output)
id: tests-pass-output
uses: Invicton-Labs/terraform-module-testing/apply-destroy@v0.2.0
with:
tf_path: tests/pass-output

- name: Initialize - Fail
id: init-fail
uses: Invicton-Labs/terraform-module-testing/initialize@v0.2.0
Expand All @@ -48,6 +59,17 @@ jobs:
with:
tf_path: tests/fail

- name: Initialize - Fail (Output)
id: init-fail-output
uses: Invicton-Labs/terraform-module-testing/initialize@v0.2.0
with:
tf_path: tests/fail-output
- name: Run Tests - Fail (Output)
id: tests-fail-output
uses: Invicton-Labs/terraform-module-testing/apply-failure@v0.2.0
with:
tf_path: tests/fail-output

# 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-output/.terraform.lock.hcl

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

11 changes: 11 additions & 0 deletions tests/fail-output/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module "fail" {
source = "../../"
condition = false
error_message = "sample error"
}

// Force the module and conditions to be evaluated
// by using the module output in a config output.
output "result" {
value = module.fail.checked
}
22 changes: 22 additions & 0 deletions tests/pass-output/.terraform.lock.hcl

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

11 changes: 11 additions & 0 deletions tests/pass-output/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module "pass" {
source = "../../"
condition = true
error_message = "sample error"
}

// Force the module and conditions to be evaluated
// by using the module output in a config output.
output "result" {
value = module.pass.checked
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 1.9.0"
required_version = ">= 1.10.3"
}

0 comments on commit b95683e

Please sign in to comment.