Skip to content

Commit

Permalink
fix(.github/workflows/workflow.yml): file updated
Browse files Browse the repository at this point in the history
  • Loading branch information
plbalmeida committed Jan 23, 2024
1 parent 8870cf8 commit 8dd932d
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,32 @@ on:
destroy:
description: 'Destroy Terraform resources (true to destroy)'
required: true
default: 'true'
default: 'false'

jobs:

destroy:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.destroy == 'true' }}
steps:
- uses: actions/checkout@v2

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

- name: Terraform Init
run: terraform init
working-directory: ./infra

- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: ./infra
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1

build:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -74,25 +97,3 @@ jobs:
- name: Start AWS CodeBuild
run: |
aws codebuild start-build --project-name practical-mlops-ch1-exercises
destroy:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.destroy == 'true' }}
steps:
- uses: actions/checkout@v2

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

- name: Terraform Init
run: terraform init
working-directory: ./infra

- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: ./infra
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1

0 comments on commit 8dd932d

Please sign in to comment.