feat(infra): add tofu-deploy

This commit is contained in:
2026-07-28 22:08:56 +02:00
parent 2efb2c8750
commit 3fbe05af17
+62
View File
@@ -0,0 +1,62 @@
name: Reusable OpenTofu Deploy Template
on:
workflow_call:
inputs:
vm_id:
description: "The Proxmox VM ID"
required: true
type: string
ip_address:
description: "The static IP address (e.g., 192.168.1.50/24)"
required: true
type: string
secrets:
PROXMOX_VE_ENDPOINT:
required: true
PROXMOX_VE_API_TOKEN:
required: true
TF_HTTP_USERNAME:
required: true
TF_HTTP_PASSWORD:
required: true
TF_HTTP_ADDRESS:
required: true
SSH_PUBLIC_KEY:
required: true
jobs:
deploy-to-proxmox:
runs-on: ubuntu-latest
env:
PROXMOX_VE_ENDPOINT: ${{ secrets.PROXMOX_VE_ENDPOINT }}
PROXMOX_VE_API_TOKEN: ${{ secrets.PROXMOX_VE_API_TOKEN }}
PROXMOX_VE_INSECURE: "true"
TF_HTTP_ADDRESS: ${{ secrets.TF_HTTP_ADDRESS }}
TF_HTTP_LOCK_ADDRESS: "${{ secrets.TF_HTTP_ADDRESS }}/lock"
TF_HTTP_UNLOCK_ADDRESS: "${{ secrets.TF_HTTP_ADDRESS }}/lock"
TF_HTTP_LOCK_METHOD: "POST"
TF_HTTP_UNLOCK_METHOD: "DELETE"
TF_HTTP_USERNAME: ${{ secrets.TF_HTTP_USERNAME }}
TF_HTTP_PASSWORD: ${{ secrets.TF_HTTP_PASSWORD }}
TF_VAR_vm_id: ${{ inputs.vm_id }}
TF_VAR_ip_address: ${{ inputs.ip_address }}
TF_VAR_ssh_public_key: ${{ secrets.SSH_PUBLIC_KEY }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
- name: OpenTofu Init
run: tofu init
- name: OpenTofu Plan
run: tofu plan -out=tfplan
- name: OpenTofu Apply
run: tofu apply -auto-approve tfplan