diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 42a290d..9d48feb 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -204,19 +204,21 @@ jobs: run: sleep 60 - name: Terraform destroy + if: always() run: | cd "${{ inputs.module_source }}" set -uo pipefail set +e set -x - terraform destroy -input=false -auto-approve -no-color > >(tee /dev/tty) 2> >(tee destroy.out >&2) EXIT_CODE=$? + terraform destroy -input=false -auto-approve -no-color > >(tee /dev/tty) 2> >(tee destroy.out >&2) + EXIT_CODE=$? set -e if [ "$EXIT_CODE" -ne 0 ]; then echo "::error title=Terraform Destroy Failed::Check summary for details" - echo "## โŒ Terraform Apply Failed" >> $GITHUB_STEP_SUMMARY + echo "## โŒ Terraform Destroy Failed" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Module:** ${{ inputs.module_source }} " >> $GITHUB_STEP_SUMMARY echo "**Test:** ${{ matrix.label }}" >> $GITHUB_STEP_SUMMARY @@ -225,7 +227,7 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "### ๐Ÿงพ Error Output" >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - tail -n 50 apply.out >> $GITHUB_STEP_SUMMARY + tail -n 50 destroy.out >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY exit 1 diff --git a/delivery/main.tf b/delivery/main.tf index 5d0f4c9..c70f94a 100644 --- a/delivery/main.tf +++ b/delivery/main.tf @@ -25,7 +25,7 @@ module "rules" { product_id = var.product_id etls = var.etls default_origin = var.default_origin - cpcode_id = tonumber(trimprefix(akamai_cp_code.this[0].id, "cpc_")) + cpcode_id = var.default_cpcode ? null : tonumber(trimprefix(akamai_cp_code.this[0].id, "cpc_")) cpcode_name = var.cpcode_name sure_route_test_object = var.sure_route_test_object td_region = var.td_region diff --git a/delivery/outputs.tf b/delivery/outputs.tf index 9cfa55c..99fe18b 100644 --- a/delivery/outputs.tf +++ b/delivery/outputs.tf @@ -9,7 +9,7 @@ output "rules_errors" { } output "cpcode_id" { - value = tonumber(trimprefix(akamai_cp_code.this[0].id, "cpc_")) + value = var.default_cpcode ? 0 : tonumber(trimprefix(akamai_cp_code.this[0].id, "cpc_")) description = "The CP Code's unique identifier." } diff --git a/delivery/tests/tfvars.tpl b/delivery/tests/tfvars.tpl index 8373a10..901dbe4 100644 --- a/delivery/tests/tfvars.tpl +++ b/delivery/tests/tfvars.tpl @@ -8,7 +8,7 @@ default_origin = "flexibleorigin.rafa.cr" forward_host_header = "flexibleorigin.rafa.cr" notification_emails = ["test@akamai.com"] version_notes = "GitHub Actions test" -certificate_id = 30192 +certificate_id = 307307 peer_reviewed_by = "test@na.com" customer_email = "test@akamai.com" unit_tested = true