Revert .yamllint to match lineage; fix issues flagged by yamllint. #13
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: Infrastructure Pipeline | |
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 | |
env: | |
URL: https://releases.hashicorp.com/terraform/1.0.7/terraform_1.0.7_linux_amd64.zip | |
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 |