Skip to content

Commit

Permalink
destroy job
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishika RAY committed Nov 14, 2024
1 parent b4eb81f commit 467954d
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 146 deletions.
148 changes: 74 additions & 74 deletions .github/workflows/waf-re-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,78 +156,78 @@ jobs:
run: terraform apply -auto-approve -input=false


# terraform_xc:
# name: "F5XC WAF"
# runs-on: ubuntu-latest
# needs: terraform_vm
# 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 Initialization ⚙️\`${{ steps.init.outcome }}\`
# #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
# <details><summary>Show Plan</summary>
# \`\`\`\n
# ${process.env.PLAN}
# \`\`\`
# </details>
# *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 Apply
# if: github.ref == 'refs/heads/deploy-waf-re' && github.event_name == 'push'
# run: terraform apply -auto-approve -input=false
terraform_xc:
name: "F5XC WAF"
runs-on: ubuntu-latest
needs: terraform_vm
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 Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*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 Apply
if: github.ref == 'refs/heads/deploy-waf-re' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false

144 changes: 72 additions & 72 deletions .github/workflows/waf-re-destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,85 +8,85 @@ on:

jobs:

terraform_xc:
name: "F5XC WAF"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./xc
steps:
- name: Checkout
uses: actions/checkout@v4
# 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: 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 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 }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*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' && github.event_name == 'push'
run: terraform destroy -auto-approve -input=false
# - 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 }}\`
# <details><summary>Show Plan</summary>
# \`\`\`\n
# ${process.env.PLAN}
# \`\`\`
# </details>
# *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' && github.event_name == 'push'
# run: terraform destroy -auto-approve -input=false

terraform_vm:
name: "Azure VM"
runs-on: ubuntu-latest
needs: terraform_xc
# needs: terraform_xc
defaults:
run:
working-directory: ./azure/azure-vm
Expand Down

0 comments on commit 467954d

Please sign in to comment.