Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Add a teardown pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolftousen authored Jan 10, 2024
1 parent 3b30d04 commit 174bb79
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "Destroy"
on:
workflow_dispatch:

env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/timebot

jobs:
plan:
name: "Terraform Plan - Destroy"
runs-on: ubuntu-latest
environment:
name: "prod-plan"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terragrunt
run: |
wget https://github.com/gruntwork-io/terragrunt/releases/download/v0.54.12/terragrunt_linux_amd64
sudo mv terragrunt_linux_amd64 /usr/local/bin/terragrunt
sudo chmod +x /usr/local/bin/terragrunt
- name: Plan Timebot Destroy
working-directory: infra/terragrunt/prod/timebot/
run: |
terragrunt plan -destroy
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
ARM_TENANT_ID: "1b4a4fed-fed8-4823-a8a0-3d5cea83d122"
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_PROD_SUBSCRIPTION_ID }}
TF_VAR_acr_subscription_id: ${{ secrets.AZURE_PROD_SUBSCRIPTION_ID }}
TF_VAR_timebot_image: "${{ env.IMAGE_NAME }}:${{ needs.build.outputs.docker_tag }}"
TF_VAR_app_token: ${{ secrets.PROD_PLAN_APP_TOKEN }}
TF_VAR_bot_user_token: ${{ secrets.PROD_PLAN_BOT_TOKEN }}
TF_VAR_harvest_token: ${{ secrets.PROD_HARVEST_TOKEN }}
TF_VAR_harvest_id: ${{ secrets.PROD_HARVEST_ID }}
TF_VAR_harvest_url: "https://api.harvestapp.com/v2/"
apply:
name: "Terraform Prod Apply"
runs-on: ubuntu-latest
environment:
name: "prod"
needs: [plan]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terragrunt
run: |
wget https://github.com/gruntwork-io/terragrunt/releases/download/v0.54.12/terragrunt_linux_amd64
sudo mv terragrunt_linux_amd64 /usr/local/bin/terragrunt
sudo chmod +x /usr/local/bin/terragrunt
- name: Destroy Timebot
working-directory: infra/terragrunt/prod/timebot/
run: |
terragrunt destroy --terragrunt-non-interactive -auto-approve
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
ARM_TENANT_ID: "1b4a4fed-fed8-4823-a8a0-3d5cea83d122"
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_PROD_SUBSCRIPTION_ID }}
TF_VAR_acr_subscription_id: ${{ secrets.AZURE_PROD_SUBSCRIPTION_ID }}
TF_VAR_timebot_image: "${{ env.IMAGE_NAME }}:${{ needs.build.outputs.docker_tag }}"
TF_VAR_app_token: ${{ secrets.PROD_APP_TOKEN }}
TF_VAR_bot_user_token: ${{ secrets.PROD_BOT_TOKEN }}
TF_VAR_harvest_token: ${{ secrets.PROD_HARVEST_TOKEN }}
TF_VAR_harvest_id: ${{ secrets.PROD_HARVEST_ID }}
TF_VAR_harvest_url: "https://api.harvestapp.com/v2/"

0 comments on commit 174bb79

Please sign in to comment.