terraform { required_providers { proxmox = { source = "bpg/proxmox" version = "~>0.56.1" } } required_version = ">=1.6.2" } locals { core_user = { name = "core" password_hash = "$6$vDMAZf/yOO6mEbcs$6VE7WD8T9/PeotszMFxatOQxB/rFmLDWsNajg4sI0O47OikSuVpqPjkxRbzcueiXn6rBUY1ubCHlp0nnoZ1VI1" } hostname_file = { path = "/etc/hostname" user = {id = 0} group = {id = 0} mode = 420 # 0644 contents = { source = format( "data:text/plain;base64,%s", base64encode(var.instance_name) ) } } ignition_configuration = jsonencode({ ignition = { version = "3.4.0" } storage = { files = [ { path = "/etc/hostname" user = {id = 0} group = {id = 0} mode = 420 # 0644 contents = { source = format( "data:text/plain;base64,%s", base64encode(var.instance_name) ) } }, ] } passwd = { users = [ local.core_user, ] } }) } resource "random_pet" "config_name" { length = 4 } locals { generated_ignition_config_file = "${path.module}/dns_resolver_ignition_config_${random_pet.config_name.id}.ign" } resource "local_file" "sftp_script_for_ignition_file" { content = <