diff --git a/.github/workflows/handler-destroy.yml b/.github/workflows/handler-destroy.yml index 0631d537..1b6eaffa 100644 --- a/.github/workflows/handler-destroy.yml +++ b/.github/workflows/handler-destroy.yml @@ -6,173 +6,91 @@ on: - destroy-command jobs: - public_active_active: - name: Destroy resources from Public Active/Active test - if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'public-active-active') }} - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - env: - WORK_DIR_PATH: ./tests/public-active-active - steps: - - name: Create URL to the run output - id: vars - run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID - - # Checkout the branch of the pull request being tested - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} - ref: ${{ github.event.client_payload.pull_request.head.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - persist-credentials: false - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v1 - with: - cli_config_credentials_hostname: 'app.terraform.io' - cli_config_credentials_token: ${{ secrets.PUBLIC_ACTIVE_ACTIVE_TFC_TOKEN }} - terraform_version: 1.0.9 - terraform_wrapper: true - - - name: Terraform Init - id: init - working-directory: ${{ env.WORK_DIR_PATH }} - run: terraform init -input=false -no-color - - - name: Terraform Destroy - id: destroy - working-directory: ${{ env.WORK_DIR_PATH }} - run: terraform destroy -auto-approve -input=false -no-color - - - name: Update comment - if: ${{ always() }} - uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2.1.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.github.payload.repository.full_name }} - comment-id: ${{ github.event.client_payload.github.payload.comment.id }} - body: | - ${{ format('### {0} Terraform Public Active/Active Destruction Report', job.status == 'success' && ':white_check_mark:' || ':x:') }} - - ${{ format(':link: [Action Summary Page]({0})', steps.vars.outputs.run-url) }} - - ${{ format('- {0} Terraform Init', steps.init.outcome == 'success' && ':white_check_mark:' || ':x:') }} - - ${{ format('- {0} Terraform Destroy', steps.destroy.outcome == 'success' && ':white_check_mark:' || ':x:') }} - - private_active_active: - name: Destroy resources from Private Active/Active - if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'private-active-active') }} - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - env: - WORK_DIR_PATH: ./tests/private-active-active - steps: - - name: Create URL to the run output - id: vars - run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID - - # Checkout the branch of the pull request being tested - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} - ref: ${{ github.event.client_payload.pull_request.head.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - persist-credentials: false - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v1 - with: - cli_config_credentials_hostname: 'app.terraform.io' - cli_config_credentials_token: ${{ secrets.PRIVATE_ACTIVE_ACTIVE_TFC_TOKEN }} - terraform_version: 1.0.9 - terraform_wrapper: true - - - name: Terraform Init - id: init - working-directory: ${{ env.WORK_DIR_PATH }} - run: terraform init -input=false -no-color - - - name: Terraform Destroy - id: destroy - working-directory: ${{ env.WORK_DIR_PATH }} - run: terraform destroy -auto-approve -input=false -no-color - - - name: Update comment - if: ${{ always() }} - uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2.1.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.github.payload.repository.full_name }} - comment-id: ${{ github.event.client_payload.github.payload.comment.id }} - body: | - ${{ format('### {0} Terraform Private Active/Active Destruction Report', job.status == 'success' && ':white_check_mark:' || ':x:') }} - - ${{ format(':link: [Action Summary Page]({0})', steps.vars.outputs.run-url) }} - - ${{ format('- {0} Terraform Init', steps.init.outcome == 'success' && ':white_check_mark:' || ':x:') }} - - ${{ format('- {0} Terraform Destroy', steps.destroy.outcome == 'success' && ':white_check_mark:' || ':x:') }} - - private_tcp_active_active: - name: Destroy resources from Private TCP Active/Active - if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'private-tcp-active-active') }} - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - env: - WORK_DIR_PATH: ./tests/private-tcp-active-active - steps: - - name: Create URL to the run output - id: vars - run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID - - # Checkout the branch of the pull request being tested - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} - ref: ${{ github.event.client_payload.pull_request.head.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - persist-credentials: false - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v1 - with: - cli_config_credentials_hostname: 'app.terraform.io' - cli_config_credentials_token: ${{ secrets.PRIVATE_TCP_ACTIVE_ACTIVE_TFC_TOKEN }} - terraform_version: 1.0.9 - terraform_wrapper: true - - - name: Terraform Init - id: init - working-directory: ${{ env.WORK_DIR_PATH }} - run: terraform init -input=false -no-color - - - name: Terraform Destroy - id: destroy - working-directory: ${{ env.WORK_DIR_PATH }} - run: terraform destroy -auto-approve -input=false -no-color - - - name: Update comment - if: ${{ always() }} - uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2.1.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.github.payload.repository.full_name }} - comment-id: ${{ github.event.client_payload.github.payload.comment.id }} - body: | - ${{ format('### {0} Terraform Private TCP Active/Active Destruction Report', job.status == 'success' && ':white_check_mark:' || ':x:') }} - - ${{ format(':link: [Action Summary Page]({0})', steps.vars.outputs.run-url) }} - - ${{ format('- {0} Terraform Init', steps.init.outcome == 'success' && ':white_check_mark:' || ':x:') }} - - ${{ format('- {0} Terraform Destroy', steps.destroy.outcome == 'success' && ':white_check_mark:' || ':x:') }} + azure_public_active_active: + uses: hashicorp/terraform-random-tfe-utility/.github/workflows/azure-destroy.yml + secrets: inherit + name: Destroy resources from Azure Public Active/Active + if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'azure-public-active-active') }} + with: + test_name: Public Active/Active + utility_test: true + module_repository_id: hashicorp/terraform-azurerm-terraform-enterprise + pull_request_repo_name: ${{ github.event.client_payload.github.payload.repository.full_name }} + pull_request_ref: ${{ github.event.client_payload.pull_request.head.sha }} + pull_request_comment_id: ${{ github.event.client_payload.github.payload.comment.id }} + work_dir: ./tests/public-active-active + TFC_token_secret_name: PUBLIC_ACTIVE_ACTIVE_TFC_TOKEN + + azure_private_active_active: + uses: hashicorp/terraform-random-tfe-utility/.github/workflows/azure-destroy.yml + secrets: inherit + name: Destroy resources from Azure Private Active/Active + if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'azure-private-active-active') }} + with: + test_name: Private Active/Active + utility_test: true + module_repository_id: hashicorp/terraform-azurerm-terraform-enterprise + pull_request_repo_name: ${{ github.event.client_payload.github.payload.repository.full_name }} + pull_request_ref: ${{ github.event.client_payload.pull_request.head.sha }} + pull_request_comment_id: ${{ github.event.client_payload.github.payload.comment.id }} + work_dir: ./tests/private-active-active + TFC_token_secret_name: PRIVATE_ACTIVE_ACTIVE_TFC_TOKEN + + azure_private_tcp_active_active: + uses: hashicorp/terraform-random-tfe-utility/.github/workflows/azure-destroy.yml + secrets: inherit + name: Destroy resources from Azure Private TCP Active/Active + if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'azure-private-tcp-active-active') }} + with: + test_name: Private TCP Active/Active + utility_test: true + module_repository_id: hashicorp/terraform-azurerm-terraform-enterprise + pull_request_repo_name: ${{ github.event.client_payload.github.payload.repository.full_name }} + pull_request_ref: ${{ github.event.client_payload.pull_request.head.sha }} + pull_request_comment_id: ${{ github.event.client_payload.github.payload.comment.id }} + work_dir: ./tests/private-tcp-active-active + TFC_token_secret_name: PRIVATE_TCP_ACTIVE_ACTIVE_TFC_TOKEN + + azure_standalone_external: + uses: hashicorp/terraform-random-tfe-utility/.github/workflows/azure-destroy.yml + secrets: inherit + name: Destroy resources from Azure Standalone External + if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'azure-standalone-external') }} + with: + test_name: Standalone External + utility_test: true + module_repository_id: hashicorp/terraform-azurerm-terraform-enterprise + pull_request_repo_name: ${{ github.event.client_payload.github.payload.repository.full_name }} + pull_request_ref: ${{ github.event.client_payload.pull_request.head.sha }} + pull_request_comment_id: ${{ github.event.client_payload.github.payload.comment.id }} + work_dir: ./tests/standalone-external + TFC_token_secret_name: STANDALONE_EXTERNAL_TFC_TOKEN + TFC_workspace_substitution_pattern: 's/terraform {/terraform {\n\ + backend "remote" {\n\ + organization = "terraform-enterprise-modules-test"\n\ + workspaces {\n\ + name = "azure-standalone-external"\n\ + }\n\ + }\n/' + + azure_standalone_mounted_disk: + uses: hashicorp/terraform-random-tfe-utility/.github/workflows/azure-destroy.yml + secrets: inherit + name: Destroy resources from Azure Standalone Mounted Disk + if: ${{ contains(github.event.client_payload.slash_command.args.unnamed.all, 'all') || contains(github.event.client_payload.slash_command.args.unnamed.all, 'azure-standalone-mounted-disk') }} + with: + test_name: Standalone Mounted Disk + utility_test: true + module_repository_id: hashicorp/terraform-azurerm-terraform-enterprise + pull_request_repo_name: ${{ github.event.client_payload.github.payload.repository.full_name }} + pull_request_ref: ${{ github.event.client_payload.pull_request.head.sha }} + pull_request_comment_id: ${{ github.event.client_payload.github.payload.comment.id }} + work_dir: ./tests/standalone-mounted-disk + TFC_token_secret_name: STANDALONE_MOUNTED_DISK_TFC_TOKEN + TFC_workspace_substitution_pattern: 's/terraform {/terraform {\n\ + backend "remote" {\n\ + organization = "terraform-enterprise-modules-test"\n\ + workspaces {\n\ + name = "azure-standalone-mounted-disk"\n\ + }\n\ + }\n/'