Skip to content

terraform modules auth using github app installation token #3

terraform modules auth using github app installation token

terraform modules auth using github app installation token #3

name: terraform modules auth using github app installation token
on:
workflow_dispatch:
#These environment variables are used by the terraform azure provider to setup OIDD authenticate.
env:
ARM_CLIENT_ID: "${{ secrets.AZURE_CLIENT_ID }}"
ARM_SUBSCRIPTION_ID: "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
ARM_TENANT_ID: "${{ secrets.ARM_TENANT_ID }}"
ARM_CLIENT_SECRET: "${{ secrets.ARM_CLIENT_SECRET }}"
run-name: terraform modules auth using github app installation token
jobs:
terraform-modules-auth-using-github-app-installation-token:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: checking files
run: ls -latR
- name: Token generator
uses: githubofkrishnadhas/github-access-using-githubapp@v1
with:
github_app_id: ${{ secrets.TOKEN_GENERATOR_APPID }}
github_app_private_key: ${{ secrets.TOKEN_GENERATOR_PRIVATE_KEY }}
github_account_type: 'user'
- name: echo token
run: echo ${GH_APP_TOKEN}
- name: setup for tfmodule
run: |
git config --local --remove-section http."https://github.com/"
git config --global url."https://githubofkrishnadhas:${GH_APP_TOKEN}@github.com/devwithkrishna".insteadOf "https://github.com/devwithkrishna"
- name: git config
run: git config --list --show-origin
- name: sleep
run: sleep 20
- name: terraform setup
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.5.7"
- name: terraform checking
run: terraform --version
- name: terraform init
run: terraform init
- name: terraform plan
run: terraform plan -out=plan.out
- name: check plan.out
run: ls -latR
- name: terraform apply
run: terraform apply --auto-approve