27 Commits

Author SHA1 Message Date
84e45b4c61 Merge pull request 'stage' (#18) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 3m58s
Reviewed-on: #18
2025-04-18 11:14:21 +00:00
MichaelFisher1997
080752e8a0 Worflow: changes vars
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 37s
2025-04-18 12:12:52 +01:00
MichaelFisher1997
f063baa349 Worflow: changes vars 2025-04-18 12:12:28 +01:00
bada1b69da Merge pull request 'stage' (#17) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m58s
Reviewed-on: #17
2025-04-18 10:43:01 +00:00
MichaelFisher1997
7d04a2c475 Worflow: changes vars
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 27s
2025-04-18 11:42:05 +01:00
MichaelFisher1997
e04f10c5a3 Worflow: changes vars
All checks were successful
Gitea Actions Demo / Terraform Plan (push) Successful in 25s
2025-04-18 11:40:44 +01:00
MichaelFisher1997
0e7860bfe7 Worflow: changes vars
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Has been cancelled
2025-04-18 11:35:01 +01:00
MichaelFisher1997
0c0cbc5def terraform apply
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 20s
2025-04-18 11:29:29 +01:00
MichaelFisher1997
fcdde6cf1f terraform apply
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 18s
2025-04-18 11:27:41 +01:00
MichaelFisher1997
524bd92da4 terraform apply
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 33s
2025-04-18 11:26:17 +01:00
MichaelFisher1997
ba3fe8e7ff terraform apply
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Failing after 22s
2025-04-18 11:01:55 +01:00
MichaelFisher1997
724a433d5e terraform fmt 2025-04-18 10:56:54 +01:00
8d9eea6728 Merge pull request 'terraform fmt' (#16) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m42s
Reviewed-on: #16
2025-04-17 21:54:27 +00:00
8d49e447e6 Merge pull request 'terraform fmt' (#15) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m39s
Reviewed-on: #15
2025-04-17 21:40:34 +00:00
d634e124a3 Merge pull request 'stage' (#14) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m11s
Reviewed-on: #14
2025-04-17 21:29:51 +00:00
70139b2693 Merge pull request 'terraform fmt' (#13) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 30s
Reviewed-on: #13
2025-04-17 21:18:18 +00:00
1b6eca0f69 Merge pull request 'stage' (#12) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m29s
Reviewed-on: #12
2025-04-17 21:00:27 +00:00
3e55a72767 Merge pull request 'stage' (#11) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 5m57s
Reviewed-on: #11
2025-04-17 20:27:27 +00:00
b26ff582a4 Merge pull request 'terraform fmt' (#10) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 5m42s
Reviewed-on: #10
2025-04-17 18:24:08 +00:00
114bfb9772 Merge pull request 'stage' (#8) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 5m24s
Reviewed-on: #8
2025-04-17 16:12:34 +00:00
5509e14066 Merge pull request 'stage' (#7) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m26s
Reviewed-on: #7
2025-04-17 15:15:02 +00:00
df088a7903 Merge pull request 'terraform apply' (#6) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m38s
Reviewed-on: #6
2025-04-17 14:06:19 +00:00
dcec6c3648 Merge pull request 'stage' (#5) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m24s
Reviewed-on: #5
2025-04-17 12:46:36 +00:00
a0ee1b8a4b Merge pull request 'terraform apply' (#4) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 1m51s
Reviewed-on: #4
2025-04-17 12:19:34 +00:00
39d4e2ac65 Merge pull request 'terraform apply' (#3) from stage into master
All checks were successful
Gitea Actions Demo / Terraform Apply (push) Successful in 4m52s
Reviewed-on: #3
2025-04-17 10:22:41 +00:00
6d06cfac02 Merge pull request 'terraform apply' (#2) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Apply (push) Failing after 2m55s
Reviewed-on: #2
2025-04-17 10:11:32 +00:00
e669353638 Merge pull request 'terraform apply' (#1) from stage into master
Some checks failed
Gitea Actions Demo / Terraform Plan (push) Successful in 37s
Gitea Actions Demo / Terraform Apply (push) Has been cancelled
Reviewed-on: #1
2025-04-17 10:04:50 +00:00
11 changed files with 47 additions and 75 deletions

View File

@@ -16,9 +16,9 @@ jobs:
pull-requests: write pull-requests: write
env: env:
TF_VAR_SSH_KEY: ${{ secrets.SSH_KEY }} TF_VAR_SSH_KEY_PUBLIC: ${{ secrets.SSH_KEY_PUBLIC }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }} TF_VAR_TS_AUTHKEY: ${{ secrets.TS_AUTHKEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }} TF_VAR_proxmox_password: ${{ secrets.PROXMOX_PASSWORD }}
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -29,11 +29,6 @@ jobs:
with: with:
terraform_version: 1.6.6 terraform_version: 1.6.6
- name: Inject sensitive secrets
working-directory: terraform
run: |
echo 'proxmox_password = "${{ secrets.PROXMOX_PASSWORD }}"' >> terraform.tfvars
- name: Terraform Init - name: Terraform Init
working-directory: terraform working-directory: terraform
run: terraform init run: terraform init

View File

@@ -14,9 +14,9 @@ jobs:
pull-requests: write pull-requests: write
env: env:
TF_VAR_SSH_KEY: ${{ secrets.SSH_KEY }} TF_VAR_SSH_KEY: ${{ secrets.TF_VAR_SSH_KEY_PUBLIC }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }} TF_VAR_TS_AUTHKEY: ${{ secrets.TF_VAR_TS_AUTHKEY }}
TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }} TF_VAR_PROXMOX_PASSWORD: ${{ secrets.TF_VAR_PROXMOX_PASSWORD }}
steps: steps:
@@ -28,11 +28,6 @@ jobs:
with: with:
terraform_version: 1.6.6 terraform_version: 1.6.6
- name: Inject sensitive secrets
working-directory: terraform
run: |
echo 'proxmox_password = "${{ secrets.PROXMOX_PASSWORD }}"' >> terraform.tfvars
- name: Terraform Init - name: Terraform Init
working-directory: terraform working-directory: terraform
run: terraform init run: terraform init

View File

@@ -17,9 +17,9 @@ jobs:
pull-requests: write pull-requests: write
env: env:
TF_VAR_SSH_KEY: ${{ secrets.SSH_KEY }} TF_VAR_SSH_KEY_PUBLIC: ${{ secrets.SSH_KEY_PUBLIC }}
TF_VAR_TS_AUTHKEY: ${{ secrets.TAILSCALE_KEY }} TF_VAR_TS_AUTHKEY: ${{ secrets.TS_AUTHKEY }}
# TF_VAR_ssh_key: ${{ secrets.SSH_PUBLIC_KEY }} TF_VAR_proxmox_password: ${{ secrets.PROXMOX_PASSWORD }}
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -30,11 +30,6 @@ jobs:
with: with:
terraform_version: 1.6.6 terraform_version: 1.6.6
- name: Inject sensitive secrets
working-directory: terraform
run: |
echo 'proxmox_password = "${{ secrets.PROXMOX_PASSWORD }}"' >> terraform.tfvars
- name: Terraform Init - name: Terraform Init
working-directory: terraform working-directory: terraform
run: terraform init run: terraform init

4
.gitignore vendored
View File

@@ -1,2 +1,6 @@
./terraform/.terraform ./terraform/.terraform
terraform/.terraform/ terraform/.terraform/
terraform/test-apply.sh
terraform/test-plan.sh
terraform/test-destroy.sh
terraform/tfplan

View File

@@ -20,25 +20,6 @@ provider "registry.terraform.io/hashicorp/local" {
] ]
} }
provider "registry.terraform.io/hashicorp/null" {
version = "3.2.3"
hashes = [
"h1:+AnORRgFbRO6qqcfaQyeX80W0eX3VmjadjnUFUJTiXo=",
"zh:22d062e5278d872fe7aed834f5577ba0a5afe34a3bdac2b81f828d8d3e6706d2",
"zh:23dead00493ad863729495dc212fd6c29b8293e707b055ce5ba21ee453ce552d",
"zh:28299accf21763ca1ca144d8f660688d7c2ad0b105b7202554ca60b02a3856d3",
"zh:55c9e8a9ac25a7652df8c51a8a9a422bd67d784061b1de2dc9fe6c3cb4e77f2f",
"zh:756586535d11698a216291c06b9ed8a5cc6a4ec43eee1ee09ecd5c6a9e297ac1",
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
"zh:9d5eea62fdb587eeb96a8c4d782459f4e6b73baeece4d04b4a40e44faaee9301",
"zh:a6355f596a3fb8fc85c2fb054ab14e722991533f87f928e7169a486462c74670",
"zh:b5a65a789cff4ada58a5baffc76cb9767dc26ec6b45c00d2ec8b1b027f6db4ed",
"zh:db5ab669cf11d0e9f81dc380a6fdfcac437aea3d69109c7aef1a5426639d2d65",
"zh:de655d251c470197bcbb5ac45d289595295acb8f829f6c781d4a75c8c8b7c7dd",
"zh:f5c68199f2e6076bce92a12230434782bf768103a427e9bb9abee99b116af7b5",
]
}
provider "registry.terraform.io/hashicorp/template" { provider "registry.terraform.io/hashicorp/template" {
version = "2.2.0" version = "2.2.0"
hashes = [ hashes = [

View File

@@ -4,9 +4,10 @@ data "template_file" "cloud_init_global" {
template = file("${path.module}/files/cloud_init_global.yaml") template = file("${path.module}/files/cloud_init_global.yaml")
vars = { vars = {
hostname = "generic" hostname = "generic"
domain = "home.arpa" domain = "home.arpa"
TS_AUTHKEY = var.TS_AUTHKEY TS_AUTHKEY = var.TS_AUTHKEY
SSH_KEY_PUBLIC = var.SSH_KEY_PUBLIC
} }
} }
@@ -14,19 +15,3 @@ resource "local_file" "cloud_init_global" {
content = data.template_file.cloud_init_global.rendered content = data.template_file.cloud_init_global.rendered
filename = "${path.module}/files/cloud_init_global.yaml" filename = "${path.module}/files/cloud_init_global.yaml"
} }
#resource "null_resource" "upload_cloud_init_alpaca" {
# count = var.alpaca_vm_count
#
# connection {
# type = "ssh"
# user = "root"
# private_key = var.ssh_key
# host = var.target_node
# }
#
# provisioner "file" {
# source = local_file.cloud_init_alpaca[count.index].filename
# destination = "/var/lib/vz/snippets/cloud_init_alpaca_${count.index + 1}.yaml"
# }
#}

View File

@@ -1,4 +1,11 @@
#cloud-config #cloud-config
#cloud-config
hostname: myvm
manage_etc_hosts: true
resolv_conf:
nameservers:
- 8.8.8.8
- 1.1.1.1
package_update: true package_update: true
package_upgrade: true package_upgrade: true
@@ -13,7 +20,6 @@ packages:
- jq - jq
- curl - curl
- qemu-guest-agent - qemu-guest-agent
- salt-minion
users: users:
- name: stuart - name: stuart
@@ -24,7 +30,6 @@ users:
- ${SSH_KEY_PUBLIC} - ${SSH_KEY_PUBLIC}
preserve_hostname: false preserve_hostname: false
manage_etc_hosts: false
fqdn: ${hostname}.${domain} fqdn: ${hostname}.${domain}
#cloud-config #cloud-config

View File

@@ -28,20 +28,24 @@ resource "proxmox_vm_qemu" "alpacas" {
cores = var.cores cores = var.cores
memory = var.memory memory = var.memory
scsihw = "virtio-scsi-pci" scsihw = "virtio-scsi-pci"
boot = "order=scsi0" boot = "order=virtio0"
bootdisk = "virtio0"
ipconfig0 = "ip=dhcp" ipconfig0 = "ip=dhcp"
cicustom = "user=local:snippets/cloud_init_global.yaml" cicustom = "user=local:snippets/cloud_init_global.yaml"
disks { disks {
scsi { virtio {
scsi0 { virtio0 {
disk { disk {
size = var.disk_size size = var.disk_size
storage = var.storage storage = var.storage
} }
} }
scsi1 { }
ide {
ide2 {
cloudinit { cloudinit {
storage = var.storage storage = var.storage
} }
@@ -71,19 +75,23 @@ resource "proxmox_vm_qemu" "llamas" {
cores = var.cores cores = var.cores
memory = var.memory memory = var.memory
scsihw = "virtio-scsi-pci" scsihw = "virtio-scsi-pci"
boot = "order=scsi0" boot = "order=virtio0"
bootdisk = "virtio0"
ipconfig0 = "ip=dhcp" ipconfig0 = "ip=dhcp"
cicustom = "user=local:snippets/cloud_init_global.yaml" cicustom = "user=local:snippets/cloud_init_global.yaml"
disks { disks {
scsi { virtio {
scsi0 { virtio0 {
disk { disk {
size = var.disk_size size = var.disk_size
storage = var.storage storage = var.storage
} }
} }
scsi1 { }
ide {
ide2 {
cloudinit { cloudinit {
storage = var.storage storage = var.storage
} }
@@ -91,6 +99,7 @@ resource "proxmox_vm_qemu" "llamas" {
} }
} }
network { network {
id = 0 id = 0
model = "virtio" model = "virtio"

View File

@@ -1,6 +1,6 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.8.3", "terraform_version": "1.11.4",
"serial": 31, "serial": 31,
"lineage": "7a39dd41-1655-172c-950b-b8c5398caf69", "lineage": "7a39dd41-1655-172c-950b-b8c5398caf69",
"outputs": {}, "outputs": {},

View File

@@ -9,5 +9,4 @@ bridge = "vmbr0"
disk_type = "scsi" disk_type = "scsi"
storage = "Flash" storage = "Flash"
pm_api_url = "https://100.105.0.115:8006/api2/json" pm_api_url = "https://100.105.0.115:8006/api2/json"
pm_user = "terraform-prov@pve" pm_user = "terraform-prov@pve"

View File

@@ -79,3 +79,7 @@ variable "TS_AUTHKEY" {
description = "Tailscale auth key used in cloud-init" description = "Tailscale auth key used in cloud-init"
} }
variable "SSH_KEY_PUBLIC" {
type = string
description = "My Public SSH key fo ssh auth list"
}