Skip to content

Plan Workflow

Plan Workflow #5

Workflow file for this run

name: Plan Workflow
on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- 'infra/**'
permissions:
contents: read
packages: write
pull-requests: write
env:
# Setting an environment variable with the value of a configuration variable
APP_NAME: ${{ vars.APP_NAME }}
# ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
# ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
# ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET}}
# ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
TF_VAR_discord_token: ${{ secrets.DISCORD_TOKEN }}
TF_VAR_clash_token: ${{ secrets.CLASH_TOKEN }}
jobs:
plan:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./infra/environments/dev
if: github.actor == 'jburns24'
steps:
- name: Checkout repository
uses: actions/checkout@v2
# - uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: alexellis/arkade-get@master
with:
# vault: latest
# jq: latest
terraform: latest
terragrunt: latest
- name: Terragrunt hcl check
run: terragrunt hclfmt --terragrunt-check
- name: Terraform fmt check
run: terraform fmt -check -recursive
- name: Terragrunt validate check
run: terragrunt run-all validate --terragrunt-non-interactive
- name: Terragrunt Plan
id: terragrunt_plan
run: |
pwd
terragrunt init --terragrunt-non-interactive
terragrunt plan --terragrunt-non-interactive -out plan.out
terragrunt show --terragrunt-non-interactive -no-color -json plan.out > plan.json
continue-on-error: true # Continue on error to ensure the plan is added as a comment on the PR.
env:
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
# ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET}}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_USE_OIDC: "true"
- uses: liatrio/[email protected]
with:
json-file: infra/environments/dev/plan.json
- name: Status
if: contains(steps.*.outcome, 'failure')
run: exit 1