From 316f541f077ed262cdf473e5d73b4cbcbfed8e91 Mon Sep 17 00:00:00 2001
From: ishikaray16 <67680446+ishikaray16@users.noreply.github.com>
Date: Thu, 5 Dec 2024 13:13:33 +0530
Subject: [PATCH] Update waf-re-ac-vm-destroy.yml
---
.github/workflows/waf-re-ac-vm-destroy.yml | 299 ++++++++++-----------
1 file changed, 149 insertions(+), 150 deletions(-)
diff --git a/.github/workflows/waf-re-ac-vm-destroy.yml b/.github/workflows/waf-re-ac-vm-destroy.yml
index d9111bc0..15c0658c 100644
--- a/.github/workflows/waf-re-ac-vm-destroy.yml
+++ b/.github/workflows/waf-re-ac-vm-destroy.yml
@@ -9,161 +9,160 @@ on:
jobs:
- # terraform_xc:
- # name: "F5XC WAF"
- # runs-on: ubuntu-latest
- # defaults:
- # run:
- # working-directory: ./xc
- # steps:
- # - name: Checkout
- # uses: actions/checkout@v4
-
- # - name: Setup Terraform
- # uses: hashicorp/setup-terraform@v3
- # with:
- # cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
-
- # - name: Setup Terraform Backend
- # id: backend
- # run: |
- # cat > backend.tf << EOF
- # terraform {
- # cloud {
- # organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}"
- # workspaces {
- # name = "${{ secrets.TF_CLOUD_WORKSPACE_XC }}"
- # }
- # }
- # }
- # EOF
- # echo "${{secrets.P12}}" | base64 -d > api.p12
-
- # - name: Terraform Init
- # id: init
- # run: terraform init
-
- # - name: Terraform Validate
- # id: validate
- # run: terraform validate -no-color
-
- # - name: Terraform Plan
- # id: plan
- # if: github.event_name == 'pull_request'
- # run: terraform plan -no-color -input=false
- # continue-on-error: true
-
- # - uses: actions/github-script@v6
- # if: github.event_name == 'pull_request'
- # env:
- # PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
- # with:
- # github-token: ${{ secrets.GITHUB_TOKEN }}
- # script: |
- # const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
- # #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
- # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
- # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
- # Show Plan
- # \`\`\`\n
- # ${process.env.PLAN}
- # \`\`\`
- #
- # *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
- # github.rest.issues.createComment({
- # issue_number: context.issue.number,
- # owner: context.repo.owner,
- # repo: context.repo.repo,
- # body: output
- # })
- # - name: Terraform Plan Status
- # if: steps.plan.outcome == 'failure'
- # run: exit 1
-
- # - name: Terraform Destroy
- # if: github.ref == 'refs/heads/destroy-waf-re-ac-vm' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch')
- # run: terraform destroy -auto-approve -input=false
-
- # terraform_vm:
- # name: "Azure VM"
- # runs-on: ubuntu-latest
- # needs: terraform_xc
- # defaults:
- # run:
- # working-directory: ./azure/azure-vm
- # steps:
- # - name: Checkout
- # uses: actions/checkout@v4
-
- # - name: Setup Terraform
- # uses: hashicorp/setup-terraform@v3
- # with:
- # cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
-
- # - name: Setup Terraform Backend
- # id: backend
- # run: |
- # cat > backend.tf << EOF
- # terraform {
- # cloud {
- # organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}"
- # workspaces {
- # name = "${{ secrets.TF_CLOUD_WORKSPACE_AZURE_VM }}"
- # }
- # }
- # }
- # EOF
-
- # - name: Terraform Init
- # id: init
- # run: terraform init
-
- # - name: Terraform Validate
- # id: validate
- # run: terraform validate -no-color
-
- # - name: Terraform Plan
- # id: plan
- # if: github.event_name == 'pull_request'
- # run: terraform plan -no-color -input=false
- # continue-on-error: true
-
- # - uses: actions/github-script@v6
- # if: github.event_name == 'pull_request'
- # env:
- # PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
- # with:
- # github-token: ${{ secrets.GITHUB_TOKEN }}
- # script: |
- # const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
- # #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
- # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
- # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
- # Show Plan
- # \`\`\`\n
- # ${process.env.PLAN}
- # \`\`\`
- #
- # *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
- # github.rest.issues.createComment({
- # issue_number: context.issue.number,
- # owner: context.repo.owner,
- # repo: context.repo.repo,
- # body: output
- # })
- # - name: Terraform Plan Status
- # if: steps.plan.outcome == 'failure'
- # run: exit 1
-
- # - name: Terraform Destroy
- # if: github.ref == 'refs/heads/destroy-waf-re-ac-vm' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch')
- # run: terraform destroy -auto-approve -input=false
+ terraform_xc:
+ name: "F5XC WAF"
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: ./xc
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Terraform
+ uses: hashicorp/setup-terraform@v3
+ with:
+ cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
+
+ - name: Setup Terraform Backend
+ id: backend
+ run: |
+ cat > backend.tf << EOF
+ terraform {
+ cloud {
+ organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}"
+ workspaces {
+ name = "${{ secrets.TF_CLOUD_WORKSPACE_XC }}"
+ }
+ }
+ }
+ EOF
+ echo "${{secrets.P12}}" | base64 -d > api.p12
+
+ - name: Terraform Init
+ id: init
+ run: terraform init
+
+ - name: Terraform Validate
+ id: validate
+ run: terraform validate -no-color
+
+ - name: Terraform Plan
+ id: plan
+ if: github.event_name == 'pull_request'
+ run: terraform plan -no-color -input=false
+ continue-on-error: true
+
+ - uses: actions/github-script@v6
+ if: github.event_name == 'pull_request'
+ env:
+ PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
+ #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
+ #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
+ #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
+ Show Plan
+ \`\`\`\n
+ ${process.env.PLAN}
+ \`\`\`
+
+ *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: output
+ })
+ - name: Terraform Plan Status
+ if: steps.plan.outcome == 'failure'
+ run: exit 1
+
+ - name: Terraform Destroy
+ if: github.ref == 'refs/heads/destroy-waf-re-ac-vm' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch')
+ run: terraform destroy -auto-approve -input=false
+ terraform_vm:
+ name: "Azure VM"
+ runs-on: ubuntu-latest
+ needs: terraform_xc
+ defaults:
+ run:
+ working-directory: ./azure/azure-vm
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Terraform
+ uses: hashicorp/setup-terraform@v3
+ with:
+ cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
+
+ - name: Setup Terraform Backend
+ id: backend
+ run: |
+ cat > backend.tf << EOF
+ terraform {
+ cloud {
+ organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}"
+ workspaces {
+ name = "${{ secrets.TF_CLOUD_WORKSPACE_AZURE_VM }}"
+ }
+ }
+ }
+ EOF
+
+ - name: Terraform Init
+ id: init
+ run: terraform init
+
+ - name: Terraform Validate
+ id: validate
+ run: terraform validate -no-color
+
+ - name: Terraform Plan
+ id: plan
+ if: github.event_name == 'pull_request'
+ run: terraform plan -no-color -input=false
+ continue-on-error: true
+
+ - uses: actions/github-script@v6
+ if: github.event_name == 'pull_request'
+ env:
+ PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
+ #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
+ #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
+ #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
+ Show Plan
+ \`\`\`\n
+ ${process.env.PLAN}
+ \`\`\`
+
+ *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: output
+ })
+ - name: Terraform Plan Status
+ if: steps.plan.outcome == 'failure'
+ run: exit 1
+
+ - name: Terraform Destroy
+ if: github.ref == 'refs/heads/destroy-waf-re-ac-vm' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch')
+ run: terraform destroy -auto-approve -input=false
terraform_infra:
name: "Azure Infra"
runs-on: ubuntu-latest
- # needs: terraform_vm
+ needs: terraform_vm
defaults:
run:
working-directory: ./azure/azure-infra