Skip to content

[wip]: Deploy rewritten highscore api as container app #81

[wip]: Deploy rewritten highscore api as container app

[wip]: Deploy rewritten highscore api as container app #81

Workflow file for this run

name: terraform
on:
push:
branches: [main]
paths:
- terraform/**
- .github/workflows/terraform.yml
pull_request:
branches: [main]
paths:
- terraform/**
- .github/workflows/terraform.yml
workflow_dispatch:
permissions:
id-token: write
contents: read
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
jobs:
staging:
runs-on: ubuntu-22.04
env:
TF_VAR_ENVIRONMENT: staging
defaults:
run:
working-directory: terraform
steps:
- uses: actions/checkout@v2
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
- name: Init
run: |
terraform -v
terraform init --input=false
- name: Validate
run: terraform validate
- name: Plan
run: terraform plan --input=false --refresh=true --out "release.tfplan"
- name: Apply
run: terraform apply --input=false release.tfplan
prod:
if: github.event_name != 'pull_request'
needs: staging
runs-on: ubuntu-22.04
env:
TF_VAR_ENVIRONMENT: prod
defaults:
run:
working-directory: terraform
steps:
- uses: actions/checkout@v2
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
- name: Init
run: |
terraform -v
terraform init --input=false \
-backend-config="resource_group_name=rg-snake-${{ env.TF_VAR_ENVIRONMENT }}" \
-backend-config="storage_account_name=stsnake${{ env.TF_VAR_ENVIRONMENT }}" \
-backend-config="key=${{ env.TF_VAR_ENVIRONMENT }}.terraform.tfstate"
- name: Validate
run: terraform validate
- name: Plan
run: terraform plan --input=false --refresh=true --out release.tfplan
- name: Apply
run: terraform apply --input=false release.tfplan