Skip to content

Instantly share code, notes, and snippets.

@joshjohanning
Created May 24, 2023 14:52
Show Gist options
  • Save joshjohanning/fc5af0acef739aa2c9b829f8f056f620 to your computer and use it in GitHub Desktop.
Save joshjohanning/fc5af0acef739aa2c9b829f8f056f620 to your computer and use it in GitHub Desktop.
terraform plan in github acitons
name: terraform plan # this doesn't show up in ui
on:
workflow_call:
inputs:
runs-on:
description: Platform to execute on
type: string
default: ubuntu-latest
additional-args:
description: Additional arguments to pass in
type: string
default: ""
var-file:
description: Environment variable file
type: string
default: ""
backend-arg:
description: Environment backend arguments
type: string
default: ""
working-directory:
description: Working directory
type: string
default: .
artifact-name:
description: Artifact name for plan
type: string
default: plan
jobs:
terraform-plan:
name: plan
runs-on: ${{ inputs.runs-on }}
environment: dev
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@v2
- run: echo "env secret- $secret"
env:
secret: ${{ secrets.MY_SECRET }}
- run: echo "repo secret- $secret"
env:
secret: ${{ secrets.MY_REPO_SECRET }}
- id: foo
uses: joshjohanning-workflows/composite-sample@main
with:
who-to-greet: 'Mona the Octocat'
my-test-input: ${{ secrets.MY_SECRET }}
- name: terraform versoin
run: terraform -v
- name: terraform plan
run: |
# terraform init -input=false ${{ inputs.backend-arg }}
# terraform plan -input=false -var-file=${{ inputs.var-file }} ${{ inputs.additional-args }} -out="out.plan"
touch out.plan
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.working-directory }}/out.plan
if-no-files-found: error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment