Skip to content

Add region to terraform plan #277

Add region to terraform plan

Add region to terraform plan #277

---
name: Infrastructure Pipeline
env:
URL: https://releases.hashicorp.com/terraform/1.0.7/terraform_1.0.7_linux_amd64.zip
on:
push:
branches:
- develop
- integration
paths:
- infrastructure/**
- .github/workflows/infrastructure.yml
pull_request:
branches:
- develop
- integration
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-cd.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-cd.tfvars -out stage-cd.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-cd.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-cd.plan || true
integration:
timeout-minutes: 4320
runs-on: ubuntu-latest
environment: integration
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=integration.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=integration.tfvars -out integration.plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
- name: Terraform apply
if: github.ref == 'refs/heads/integration'
run: terraform apply integration.plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- if: ${{ always() }}
run: rm integration.plan || true