PoC OpenTofu configuration works

This commit is contained in:
2026-06-09 09:39:23 +02:00
parent edede0b568
commit 8990d34565
6 changed files with 144 additions and 0 deletions

37
cloud-conf.tf Normal file
View File

@@ -0,0 +1,37 @@
data "local_file" "ssh_public_key" {
filename = "./id_ed25519_rocky.pub"
}
resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
content_type = "snippets"
datastore_id = "local"
node_name = var.virtual_environment_node_name
source_raw {
data = <<-EOF
#cloud-config
hostname: test-ubuntu
timezone: Europe/Berlin
users:
- default
- name: ubuntu
groups:
- sudo
shell: /bin/bash
ssh_authorized_keys:
- ${trimspace(data.local_file.ssh_public_key.content)}
sudo: ALL=(ALL) NOPASSWD:ALL
package_update: true
packages:
- qemu-guest-agent
- net-tools
- curl
runcmd:
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
EOF
file_name = "user-data-cloud-config.yaml"
}
}