From dba864460cf25a90425dd7cc4b024b635d64e520 Mon Sep 17 00:00:00 2001 From: sohcato Date: Wed, 30 Sep 2026 23:38:16 -0700 Subject: [PATCH] add ci/cd action workflow for terraform deployment --- .gitea/workflows/main.yml | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitea/workflows/main.yml diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml new file mode 100644 index 0000000..5bebf73 --- /dev/null +++ b/.gitea/workflows/main.yml @@ -0,0 +1,42 @@ +name: Terraform CI +run-name: $${{ gitea.actor }} triggered a Terraform CI +on: + push: + branches: + - main + pull_request: + +jobs: + terraform: + runs-on: infra-terraform + + defaults: + run: + working-directory: environments/prod/proxmox + + env: + PROXMOX_VE_ENDPOINT: ${{ secrets.PROXMOX_VE_ENDPOINT }} + PROXMOX_VE_API_TOKEN: ${{ secrets.PROXMOX_VE_API_TOKEN }} + + steps: + - name: Checkout repository + - uses: actions/checkout@v4 + + # Job will fail if you didn't run `terraform fmt -recursive` + - name: Check formatting + run: terraform fmt-check -recursive + + - name: Initialize Terraform modules + run: terraform init + + - name: Validate Terraform + run: terraform validate + + - name: Create Terraform plan + run: terraform plan -out=tfplan + + # Job will apply the plan if pushed to main + - name: Conditionally apply the Terraform plan + if: github.event_name == 'push' && github.ref == 'refs/head/main' + run: terraform apply -auto-approve +