Skip to content

Commit

Permalink
feat: pipeline terraform apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao Henrique Toigo committed Oct 2, 2024
1 parent 4d4634e commit 8449900
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/tf_apply.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Terraform Apply
on:
push:
branches:
- main

env:
AWS_REGION: ${{ vars.AWS_REGION }}

jobs:
terraform-apply:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Terraform
uses: hashicorp/setup-terraform@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Terraform Init
run: terraform init --backend-config=environment/dev/backend.tfvars

- name: Terraform Plan
id: plan
run: terraform plan -var-file environment/dev/terraform.tfvars -out=tfplan

- name: Terraform Apply
run: terraform apply -auto-approve tfplan

- name: Clean up plan file
run: rm -f tfplan

0 comments on commit 8449900

Please sign in to comment.