0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00

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>
This commit is contained in:
Pavel Boldyrev 2025-03-19 22:11:07 -04:00 committed by GitHub
parent 2a4eceb6f4
commit a681e828bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 51 additions and 38 deletions

View File

@ -20,15 +20,12 @@ resource "proxmox_virtual_environment_vm" "ubuntu_template" {
node_name = "pve"
template = true
started = false
machine = "q35"
bios = "ovmf"
description = "Managed by Terraform"
agent {
enabled = true
}
cpu {
cores = 2
}
@ -89,6 +86,11 @@ resource "proxmox_virtual_environment_vm" "ubuntu_clone" {
}
agent {
# NOTE: The agent is installed and enabled as part of the cloud-init configuration in the template VM, see cloud-config.tf
# The working agent is *required* to retrieve the VM IP addresses.
# If you are using a different cloud-init configuration, or a different clone source
# that does not have the qemu-guest-agent installed, you may need to disable the `agent` below and remove the `vm_ipv4_address` output.
# See https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_vm#qemu-guest-agent for more details.
enabled = true
}

View File

@ -82,6 +82,7 @@ resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
data = <<-EOF
#cloud-config
hostname: test-ubuntu
timezone: America/Toronto
users:
- default
- name: ubuntu
@ -91,13 +92,15 @@ resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
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:
- apt update
- apt install -y qemu-guest-agent net-tools
- timedatectl set-timezone America/Toronto
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
EOF
file_name = "user-data-cloud-config.yaml"

View File

@ -35,14 +35,14 @@ resource "proxmox_virtual_environment_file" "vendor_config" {
node_name = data.proxmox_virtual_environment_datastores.example.node_name
source_raw {
data = <<EOF
#cloud-config
runcmd:
- apt update
- apt install -y qemu-guest-agent
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/vendor-cloud-init-done
data = <<-EOF
#cloud-config
runcmd:
- apt update
- apt install -y qemu-guest-agent
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/vendor-cloud-init-done
EOF
file_name = "terraform-provider-proxmox-example-vendor-config.yaml"
@ -56,8 +56,8 @@ resource "proxmox_virtual_environment_file" "meta_config" {
node_name = data.proxmox_virtual_environment_datastores.example.node_name
source_raw {
data = <<EOF
local-hostname: myhost.internal
data = <<-EOF
local-hostname: myhost.internal
EOF
file_name = "meta-config.yaml"

View File

@ -28,5 +28,5 @@ variable "release_20240725_ubuntu_24_noble_lxc_img_url" {
variable "release_20240725_ubuntu_24_noble_lxc_img_checksum" {
type = string
description = "The checksum for the Ubuntu 24.04 LXC image"
default = "d767d38cb25b2c25d84edc31a80dd1c29a8c922b74188b0e14768b2b2fb6df8e"
default = "10331782a01cd2348b421a261f0e15ba041358bd540f66f2432b162e70b90d28"
}

View File

@ -7,6 +7,11 @@ resource "proxmox_virtual_environment_vm" "ubuntu_clone" {
}
agent {
# NOTE: The agent is installed and enabled as part of the cloud-init configuration in the template VM, see cloud-config.tf
# The working agent is *required* to retrieve the VM IP addresses.
# If you are using a different cloud-init configuration, or a different clone source
# that does not have the qemu-guest-agent installed, you may need to disable the `agent` below and remove the `vm_ipv4_address` output.
# See https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_vm#qemu-guest-agent for more details.
enabled = true
}

View File

@ -11,6 +11,7 @@ resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
data = <<-EOF
#cloud-config
hostname: test-ubuntu
timezone: America/Toronto
users:
- default
- name: ubuntu
@ -20,13 +21,15 @@ resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
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:
- apt update
- apt install -y qemu-guest-agent net-tools
- timedatectl set-timezone America/Toronto
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
EOF
file_name = "user-data-cloud-config.yaml"

View File

@ -3,15 +3,12 @@ resource "proxmox_virtual_environment_vm" "ubuntu_template" {
node_name = "pve"
template = true
started = false
machine = "q35"
bios = "ovmf"
description = "Managed by Terraform"
agent {
enabled = true
}
cpu {
cores = 2
}

View File

@ -11,6 +11,7 @@ resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
data = <<-EOF
#cloud-config
hostname: test-ubuntu
timezone: America/Toronto
users:
- default
- name: ubuntu
@ -20,13 +21,15 @@ resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
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:
- apt update
- apt install -y qemu-guest-agent net-tools
- timedatectl set-timezone America/Toronto
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/cloud-config.done
EOF
file_name = "user-data-cloud-config.yaml"

View File

@ -32,7 +32,7 @@ import (
// Temporary: while migrating to the TF framework, we need to copy the generated docs to the right place
// for the resources / data sources that have been migrated.
// //go:generate cp -R ./build/docs-gen/guides/. ./docs/guides/
//go:generate cp -R ./build/docs-gen/guides/. ./docs/guides/
//go:generate cp ./build/docs-gen/data-sources/virtual_environment_acme_account.md ./docs/data-sources/
//go:generate cp ./build/docs-gen/data-sources/virtual_environment_acme_accounts.md ./docs/data-sources/
//go:generate cp ./build/docs-gen/data-sources/virtual_environment_acme_plugin.md ./docs/data-sources/