Skip to content

Update aws requirement from ~> 4.0 to ~> 5.54 in /infrastructure #121

Update aws requirement from ~> 4.0 to ~> 5.54 in /infrastructure

Update aws requirement from ~> 4.0 to ~> 5.54 in /infrastructure #121

Workflow file for this run

---
name: Infrastructure Pipeline
env:
URL: https://releases.hashicorp.com/terraform/1.0.7/terraform_1.0.7_linux_amd64.zip
on:
push:
branches:
- develop
- production
paths:
- infrastructure/**
- .github/workflows/infrastructure.yml
pull_request:
branches:
- develop
- production
paths:
- infrastructure/**
- .github/workflows/infrastructure.yml
defaults:
run:
working-directory: ./infrastructure
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Terraform
run: |
wget ${{ env.URL }}
unzip terraform_1.0.7_linux_amd64.zip
sudo mv terraform /usr/local/bin
- name: Check format
run: terraform fmt -recursive -check -diff
staging:
timeout-minutes: 4320
runs-on: ubuntu-latest
environment: staging
concurrency: '1'
steps:
- uses: actions/checkout@v3
- name: Install Terraform
run: |
wget ${{ env.URL }}
unzip terraform_1.0.7_linux_amd64.zip
sudo mv terraform /usr/local/bin
- name: Terraform init
run: terraform init -backend-config=stage.config
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Terraform validation
run: terraform validate
- name: Terraform plan
run: terraform plan -var-file=stage.tfvars -out stage.plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Terraform apply
if: github.ref == 'refs/heads/develop'
run: terraform apply stage.plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- if: ${{ always() }}
run: rm stage.plan || true
prod:
timeout-minutes: 4320
runs-on: ubuntu-latest
environment: production
concurrency: '1'
steps:
- uses: actions/checkout@v3
- name: Install Terraform
run: |
wget ${{ env.URL }}
unzip terraform_1.0.7_linux_amd64.zip
sudo mv terraform /usr/local/bin
- name: Terraform init
run: terraform init -backend-config=prod.config -input=false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Terraform validation
run: terraform validate
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Terraform plan
run: terraform plan -var-file=prod.tfvars -out prod.plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Terraform apply
if: github.ref == 'refs/heads/production'
run: terraform apply prod.plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- if: ${{ always() }}
run: rm prod.plan || true