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 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 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 EOF file_name = "user-data-cloud-config.yaml" } }