Merge pull request #18 from descomplicando-terraform/tf_docs #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |