0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00
terraform-provider-proxmox/examples/guides/clone-vm/cloud-config.tf
Pavel Boldyrev a681e828bf
chore(docs): update cloud-init configuration examples (#1830)
* chore(docs): update cloud-init and VM configuration examples

- Added timezone and package installation for qemu-guest-agent in cloud-init configuration.
- Updated VM configuration to include 'started' attribute and clarified agent usage in documentation.

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* not sure why the image checksum has changed

This looks a bit suspicious, but I can ignore this for the test code. In production that would be a red flag requiring investigation

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-03-19 22:11:07 -04:00

38 lines
856 B
HCL

data "local_file" "ssh_public_key" {
filename = "./id_rsa.pub"
}
resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
content_type = "snippets"
datastore_id = "local"
node_name = "pve"
source_raw {
data = <<-EOF
#cloud-config
hostname: test-ubuntu
timezone: America/Toronto
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"
}
}