feat: update tofu
This commit is contained in:
@@ -3,47 +3,38 @@ on:
|
|||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
vm_id:
|
vm_id:
|
||||||
description: "The Proxmox VM ID"
|
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
ip_address:
|
ip_address:
|
||||||
description: "The static IP address (e.g., 192.168.1.50/24)"
|
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
hostname:
|
||||||
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
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-to-proxmox:
|
deploy-to-proxmox:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
|
# Proxmox Auth (Pulled from Org-level secrets)
|
||||||
PROXMOX_VE_ENDPOINT: ${{ secrets.PROXMOX_VE_ENDPOINT }}
|
PROXMOX_VE_ENDPOINT: ${{ secrets.PROXMOX_VE_ENDPOINT }}
|
||||||
PROXMOX_VE_API_TOKEN: ${{ secrets.PROXMOX_VE_API_TOKEN }}
|
PROXMOX_VE_API_TOKEN: ${{ secrets.PROXMOX_VE_API_TOKEN }}
|
||||||
PROXMOX_VE_INSECURE: "true"
|
PROXMOX_VE_INSECURE: "true"
|
||||||
|
|
||||||
TF_HTTP_ADDRESS: ${{ secrets.TF_HTTP_ADDRESS }}
|
# Gitea State Backend Configuration
|
||||||
TF_HTTP_LOCK_ADDRESS: "${{ secrets.TF_HTTP_ADDRESS }}/lock"
|
TF_HTTP_ADDRESS: "${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}"
|
||||||
TF_HTTP_UNLOCK_ADDRESS: "${{ secrets.TF_HTTP_ADDRESS }}/lock"
|
TF_HTTP_LOCK_ADDRESS: "${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}/lock"
|
||||||
|
TF_HTTP_UNLOCK_ADDRESS: "${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/terraform/state/${{ gitea.event.repository.name }}/lock"
|
||||||
TF_HTTP_LOCK_METHOD: "POST"
|
TF_HTTP_LOCK_METHOD: "POST"
|
||||||
TF_HTTP_UNLOCK_METHOD: "DELETE"
|
TF_HTTP_UNLOCK_METHOD: "DELETE"
|
||||||
TF_HTTP_USERNAME: ${{ secrets.TF_HTTP_USERNAME }}
|
TF_HTTP_USERNAME: ${{ gitea.actor }}
|
||||||
TF_HTTP_PASSWORD: ${{ secrets.TF_HTTP_PASSWORD }}
|
TF_HTTP_PASSWORD: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
# VM Variables
|
||||||
TF_VAR_vm_id: ${{ inputs.vm_id }}
|
TF_VAR_vm_id: ${{ inputs.vm_id }}
|
||||||
TF_VAR_ip_address: ${{ inputs.ip_address }}
|
TF_VAR_ip_address: ${{ inputs.ip_address }}
|
||||||
TF_VAR_ssh_public_key: ${{ secrets.SSH_PUBLIC_KEY }}
|
TF_VAR_hostname: ${{ inputs.hostname }}
|
||||||
|
TF_VAR_ssh_public_key: ${{ secrets.SSH_PUBLIC_KEY }} # (From Org-level)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
@@ -52,11 +43,7 @@ jobs:
|
|||||||
- name: Setup OpenTofu
|
- name: Setup OpenTofu
|
||||||
uses: opentofu/setup-opentofu@v1
|
uses: opentofu/setup-opentofu@v1
|
||||||
|
|
||||||
- name: OpenTofu Init
|
- name: OpenTofu Init & Apply
|
||||||
run: tofu init
|
run: |
|
||||||
|
tofu init
|
||||||
- name: OpenTofu Plan
|
tofu apply -auto-approve
|
||||||
run: tofu plan -out=tfplan
|
|
||||||
|
|
||||||
- name: OpenTofu Apply
|
|
||||||
run: tofu apply -auto-approve tfplan
|
|
||||||
Reference in New Issue
Block a user