terraform modules auth using github app installation token #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.AZURE_TENANT_ID }}" | |
ARM_CLIENT_SECRET: "${{ secrets.AZURE_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: 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: 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 | |