Skip to content

Instantly share code, notes, and snippets.

@lalits77
Created March 29, 2024 21:28
Show Gist options
  • Save lalits77/16181d69596aef01cfad4b4b2add21a9 to your computer and use it in GitHub Desktop.
Save lalits77/16181d69596aef01cfad4b4b2add21a9 to your computer and use it in GitHub Desktop.
Github Action workflow
name: Terraform Plan
on:
workflow_dispatch:
env:
TERRAFORM_VERSION: "1.3.7"
TERRAFORM_DIRECTORY: "terraform"
permissions:
id-token: write
contents: read
pull-requests: write
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.terraform_version }}
terraform_wrapper: false
- name: "Get Application Token"
id: get_app_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.TERRAFORM_APP_ID }}
private_key: ${{ secrets.TERRAFORM_PRIVATE_KEY }}
- name: Extend Git credentials
uses: de-vri-es/setup-git-credentials@v2.1.2
with:
credentials: https://user:${{ steps.get_app_token.outputs.token }}@github.com
- name: Terraform Init
shell: bash
run: |
terraform init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment