Skip to content

hostname not set using cloud init snippet #1666

Answered by loganmancuso
Surfjoan asked this question in Q&A
Discussion options

You must be logged in to vote

I think you might just be missing the 'hostname:' parameter in your yaml, here is my default cloud-init snippet. The line hostname: ${var.instance.name}.local sets the name.

resource "proxmox_virtual_environment_file" "cloudinit" {
  content_type = "snippets"
  datastore_id = "local"
  node_name    = local.node.name

  source_raw {
    file_name = "${var.instance.name}.cloud-config.yaml"
    data      = <<EOT
#cloud-config
hostname: ${var.instance.name}.local
users:
  - name: ${local.credentials_instance.username}
    primary_group: ${local.credentials_instance.username}
    password: "${local.credentials_instance.hashed_password}"
    lock_passwd: false
    ssh-authorized-keys:
      - $…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bpg
Comment options

bpg Dec 5, 2024
Maintainer

Answer selected by bpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants