Skip to content

Terraform Destroy Deploy to AWS #4

Terraform Destroy Deploy to AWS

Terraform Destroy Deploy to AWS #4

Workflow file for this run

name: Terraform Destroy Deploy to AWS
on:
workflow_dispatch: # Configuração para deploy manual
jobs:
build:
name: Terraform Deploy
runs-on: ubuntu-latest
environment:
name: staging
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.9.8
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Get Session Token
run: echo aws sts get-session-token
- name: Initialize Terraform
working-directory: ./src/infra
run: terraform init
- name: Terraform Plan
working-directory: ./src/infra
run: terraform plan -destroy -out=tfplan
- name: Terraform Apply
working-directory: ./src/infra
run: terraform apply -auto-approve tfplan