Merge pull request #14 from 0bCdian/staging/add_roles #7
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: OpenTofu Staging Apply Workflow | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TF_VERSION: "1.8.8" | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "staging/**" | |
workflow_dispatch: | |
jobs: | |
tofu: | |
runs-on: ubuntu-latest | |
environment: staging | |
permissions: | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Google Auth | |
id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} | |
- name: Setup OpenTofu | |
uses: opentofu/setup-opentofu@v1 | |
with: | |
tofu_version: ${{ env.TF_VERSION }} | |
tofu_wrapper: true | |
- name: Manual Approval Apply | |
uses: trstringer/manual-approval@v1 | |
with: | |
secret: ${{ secrets.GITHUB_TOKEN }} | |
approvers: "0bCdian" | |
minimum-approvals: 1 | |
issue-title: "Tofu apply staging approval" | |
issue-body: "Please approve or deny applying the plan" | |
exclude-workflow-initiator-as-approver: false | |
additional-approved-words: "" | |
additional-denied-words: "" | |
timeout-minutes: 60 | |
- name: Tofu Init | |
id: init | |
run: tofu -chdir="./staging" init -lock=false -input=false | |
- name: Tofu Apply Staging | |
id: apply | |
env: | |
TF_VAR_project_id: ${{vars.PROJECT_ID}} | |
TF_VAR_region: ${{vars.REGION}} | |
if: ${{ success() }} | |
run: tofu -chdir="./staging" apply -auto-approve -input=false |