Skip to content

Commit

Permalink
Merge pull request #5 from pablom58/feat/tf-destroy
Browse files Browse the repository at this point in the history
feat: tf-destroy
  • Loading branch information
pablom58 authored Nov 24, 2024
2 parents e9e018d + 0a9b7bf commit 254e8e5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ permissions:
contents: read

jobs:
integration:
uses: ./.github/workflows/integration.yml
secrets: inherit
# integration:
# uses: ./.github/workflows/integration.yml
# secrets: inherit
#
# tf-plan:
# needs: [integration]
# uses: ./.github/workflows/tf-plan.yml
# secrets: inherit
#
# tf-apply:
# needs: [ integration, tf-plan ]
# uses: ./.github/workflows/tf-apply.yml
# secrets: inherit
#
# deploy:
# needs: [ integration, tf-plan, tf-apply ]
# uses: ./.github/workflows/deploy.yml
# secrets: inherit

tf-plan:
needs: [integration]
uses: ./.github/workflows/tf-plan.yml
secrets: inherit

tf-apply:
tf-destroy:
needs: [ integration, tf-plan ]
uses: ./.github/workflows/tf-apply.yml
secrets: inherit

deploy:
needs: [ integration, tf-plan, tf-apply ]
uses: ./.github/workflows/deploy.yml
uses: ./.github/workflows/tf-destroy.yml
secrets: inherit
48 changes: 48 additions & 0 deletions .github/workflows/tf-destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Tf Destroy Flow'

on:
workflow_call:
inputs:
environment:
description: 'App Env'
required: false
type: string
default: devel
working_directory:
description: 'App Path'
required: false
type: string
default: infrastructure/aws


permissions:
id-token: write
contents: read

jobs:
tf-apply:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_TF_ROLE }}
aws-region: us-east-1

- name: Checkout code
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3

- name: TF init
working-directory: ${{ inputs.working_directory }}
run: |
terraform init
- name: TF Destroy
working-directory: ${{ inputs.working_directory }}
run: |
terraform destroy --auto-approve

0 comments on commit 254e8e5

Please sign in to comment.