Compare commits

5 Commits

Author SHA1 Message Date
MichaelFisher1997
5a0f927532 terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 25s
2025-04-17 17:08:31 +01:00
MichaelFisher1997
e968321c39 terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 40s
2025-04-17 17:06:33 +01:00
MichaelFisher1997
feb21cadfa terraform fmt
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 24s
2025-04-17 17:04:06 +01:00
MichaelFisher1997
36cba568f2 terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 19s
2025-04-17 17:02:46 +01:00
MichaelFisher1997
c1c533f92d terraform fmt
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 24s
2025-04-17 16:58:28 +01:00
5 changed files with 69 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
name: Gitea Actions Demo name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 run-name: ${{ gitea.actor }} is deploying with Terraform 🚀
on: on:
push: push:
@@ -15,6 +15,10 @@ jobs:
contents: read contents: read
pull-requests: write pull-requests: write
env:
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -33,7 +37,6 @@ jobs:
working-directory: terraform working-directory: terraform
run: terraform init run: terraform init
- name: Terraform Plan - name: Terraform Plan
working-directory: terraform working-directory: terraform
run: terraform plan run: terraform plan

View File

@@ -0,0 +1,41 @@
name: Gitea Destroy Terraform
run-name: ${{ gitea.actor }} triggered a Terraform Destroy 🧨
on:
workflow_dispatch: # Manual trigger
jobs:
destroy:
name: "Terraform Destroy"
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
env:
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.6
- name: Inject sensitive secrets
working-directory: terraform
run: |
echo 'proxmox_password = "${{ secrets.PROXMOX_PASSWORD }}"' >> terraform.tfvars
- name: Terraform Init
working-directory: terraform
run: terraform init
- name: Terraform Destroy
working-directory: terraform
run: terraform destroy -auto-approve

View File

@@ -16,6 +16,12 @@ jobs:
contents: read contents: read
pull-requests: write pull-requests: write
env:
TF_VAR_TAILSCALE_KEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@@ -7,10 +7,11 @@ data "template_file" "cloud_init_alpaca" {
ssh_key = var.ssh_key ssh_key = var.ssh_key
hostname = "alpaca-${count.index + 1}" hostname = "alpaca-${count.index + 1}"
domain = "home.arpa" domain = "home.arpa"
tailscale_key = var.tailscale_key TS_AUTHKEY = var.TS_AUTHKEY
} }
} }
resource "local_file" "cloud_init_alpaca" { resource "local_file" "cloud_init_alpaca" {
count = var.alpaca_vm_count count = var.alpaca_vm_count
content = data.template_file.cloud_init_alpaca[count.index].rendered content = data.template_file.cloud_init_alpaca[count.index].rendered
@@ -41,10 +42,11 @@ data "template_file" "cloud_init_llama" {
ssh_key = var.ssh_key ssh_key = var.ssh_key
hostname = "llama-${count.index + 1}" hostname = "llama-${count.index + 1}"
domain = "home.arpa" domain = "home.arpa"
tailscale_key = var.tailscale_key TS_AUTHKEY = var.TS_AUTHKEY
} }
} }
resource "local_file" "cloud_init_llama" { resource "local_file" "cloud_init_llama" {
count = var.llama_vm_count count = var.llama_vm_count
content = data.template_file.cloud_init_llama[count.index].rendered content = data.template_file.cloud_init_llama[count.index].rendered

View File

@@ -74,11 +74,12 @@ variable "llama_vm_count" {
description = "How many Llama VMs to create" description = "How many Llama VMs to create"
} }
variable "tailscale_key" { variable "TS_AUTHKEY" {
type = string type = string
description = "Tailscale auth key" description = "Tailscale auth key used in cloud-init"
} }
variable "ssh_key" { variable "ssh_key" {
type = string type = string
description = "Public SSH key used by cloud-init" description = "Public SSH key used by cloud-init"