Build Docker and Apply Terraform Changes to AWS #9
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: Build Docker and Apply Terraform Changes to AWS | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- 'docker/**' # Exclude changes made in the specific directory | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: ${{ secrets.AWS_REGION }} | |
# execute Terraform | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: latest | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Plan | |
run: terraform plan -input=false -var 'site_domain=${{ secrets.TF_VAR_SITE_DOMAIN }}' -var 'public_alb_domain=${{ secrets.TF_VAR_PUBLIC_ALB_DOMAIN }}' | |
- name: Terraform Apply | |
run: terraform apply -auto-approve -var 'site_domain=${{ secrets.TF_VAR_SITE_DOMAIN }}' -var 'public_alb_domain=${{ secrets.TF_VAR_PUBLIC_ALB_DOMAIN }}' |