Skip to content

Instantly share code, notes, and snippets.

@a5r0n
Created March 7, 2022 16:41
Show Gist options
  • Select an option

  • Save a5r0n/34e4033b930b88016460f074a8e384f5 to your computer and use it in GitHub Desktop.

Select an option

Save a5r0n/34e4033b930b88016460f074a8e384f5 to your computer and use it in GitHub Desktop.
packer {
required_plugins {
hcloud = {
version = ">= 1.0.0"
source = "github.com/hashicorp/hcloud"
}
}
}
variable "talos_version" {
type = string
default = "v0.14.0"
}
locals {
image = "https://github.com/talos-systems/talos/releases/download/${var.talos_version}/hcloud-amd64.raw.xz"
}
source "hcloud" "talos" {
rescue = "linux64"
image = "debian-11"
location = "hel1"
server_type = "cx11"
ssh_username = "root"
snapshot_name = "talos system disk ${var.talos_version}"
snapshot_labels = {
type = "infra",
os = "talos",
version = "${var.talos_version}",
caph-image-name = "talos_${var.talos_version}"
}
}
build {
sources = ["source.hcloud.talos"]
provisioner "shell" {
inline = [
"apt-get install -y wget",
"wget -O /tmp/talos.raw.xz ${local.image}",
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/sda && sync",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment