Skip to content

TF Plan

TF Plan #8

name: "TF Plan"
on:
pull_request:
workflow_dispatch:
env:
TF_CLOUD_ORGANIZATION: "thejoeker"
TF_API_TOKEN: "${{ secrets.TF_API_KEY }}"
TF_WORKSPACE: "terraform-jamfpro-demo"
CONFIG_DIRECTORY: "workload/terraform/jamfpro"
PIPELINE_DEBUG: "true"
# other env vars are set within tfcloud directly for within the tf workspace
jobs:
terraform:
if: github.repository != 'hashicorp-education/learn-terraform-github-actions'
name: "Terraform Plan"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/[email protected]
- name: Upload Configuration
uses: hashicorp/tfc-workflows-github/actions/[email protected]
id: plan-upload
with:
workspace: ${{ env.TF_WORKSPACE }}
directory: ${{ env.CONFIG_DIRECTORY }}
speculative: true
- name: Create Plan Run
uses: hashicorp/tfc-workflows-github/actions/[email protected]
id: plan-run
with:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ steps.plan-upload.outputs.configuration_version_id }}
plan_only: true
- name: Get Plan Output
uses: hashicorp/tfc-workflows-github/actions/[email protected]
id: plan-output
with:
plan: ${{ fromJSON(steps.plan-run.outputs.payload).data.relationships.plan.data.id }}