variable "hcloud_token" { type = string default = env("HCLOUD_TOKEN") sensitive = true } packer { required_plugins { hcloud = { source = "github.com/hetznercloud/hcloud" version = ">= 1.6.0, < 2.0.0" } } } variable "channel" { type = string default = "stable" } # variable "arch" { # type = string # default = "amd64" # } # variable "server_type" { # type = string # default = "cx22" # } # variable "server_location" { # type = string # default = "fsn1" # } source "hcloud" "flatcar" { # token = var.hcloud_token image = "debian-11" location = "fsn1" rescue = "linux64" server_type = var.server_type snapshot_name = "flatcar-${var.channel}-${var.arch}" snapshot_labels = { os = "flatcar" channel = var.channel } ssh_username = "root" } build { sources = ["source.hcloud.flatcar"] provisioner "shell" { inline = [ # Download script and dependencies "apt-get -y install gawk", "curl -fsSLO --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 https://raw.githubusercontent.com/flatcar/init/flatcar-master/bin/flatcar-install", "chmod +x flatcar-install", # Install flatcar "./flatcar-install -s -o hetzner -C ${var.channel}", ] } }