First commit to integration #267
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 | |
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.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 | |
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 }} | |
- 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 |