datvo2k has trigged the pipeline #1
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 CI/CD Pipeline for Deploying AWS | |
run-name: ${{ github.actor }} has trigged the pipeline | |
on: | |
push: | |
branches: | |
- main | |
permissions: read-all | |
env: | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
jobs: | |
build-infra: | |
name: terraform-ci-cd | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
# check the repository to the github action runner | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
working-directory: ./src | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate | |
working-directory: ./src | |
continue-on-error: false | |
- name: Terraform Plan | |
id: plan | |
run: terraform plan --var-file="terraform.tfvars" | |
working-directory: ./src | |
continue-on-error: false | |
- name: Terraform Apply | |
id: apply | |
run: terraform apply --auto-approve | |
working-directory: ./src | |
continue-on-error: false |