Skip to content

feat: remove load balancer #66

feat: remove load balancer

feat: remove load balancer #66

Workflow file for this run

name: "main/terraform/deployment"
on:
push:
branches: [ "main" ]
paths:
- 'infrastructure/**'
- '.github/workflows/terraform.yaml'
pull_request:
branches: [ "main" ]
paths:
- 'infrastructure/**'
- '.github/workflows/terraform.yaml'
jobs:
terraform:
permissions:
contents: 'read'
id-token: 'write'
pull-requests: 'write' #Needed to comment on the PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: 'plannerAuth'
if: github.ref != 'refs/heads/main'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.GCP_USMA_TF_PLAN }}'
- id: 'applierAuth'
if: github.ref == 'refs/heads/main'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.GCP_USMA_TF_APPLY }}'
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.4.5
- id: fmt
name: Terraform fmt
working-directory: infrastructure
run: terraform fmt -check
- id: init
name: Terraform Init
working-directory: infrastructure
run: terraform init -input=false
- id: validate
name: Terraform Validate
run: terraform validate -no-color
- id: plan
name: Terraform Plan
working-directory: infrastructure
run: terraform plan -no-color
continue-on-error: true
- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
working-directory: infrastructure
run: terraform apply -auto-approve -input=false