packer: use Flatcar release servers

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2024-05-30 14:00:27 +02:00
parent 4b3c117d13
commit e6892079dd
No known key found for this signature in database
GPG key ID: AC5CCFB52545D9B8

View file

@ -16,47 +16,47 @@ variable "hcloud_token" {
variable "hcloud_server_type" { variable "hcloud_server_type" {
type = map(string) type = map(string)
default = { default = {
x86 = "cx11" x86 = "cx11"
arm = "cax11" arm = "cax11"
} }
} }
variable "image_base_url" { variable "channel" {
type = string type = string
default = "https://bincache.flatcar-linux.net/images" default = "beta"
} }
variable "image_version_id" { variable "image_version_id" {
type = string type = string
default = "9999.0.0+hetzner" default = "current"
} }
variable "flatcar_install_script" { variable "flatcar_install_script" {
type = string type = string
default = "https://raw.githubusercontent.com/flatcar/init/flatcar-master/bin/flatcar-install" default = "https://raw.githubusercontent.com/flatcar/init/flatcar-master/bin/flatcar-install"
} }
locals { locals {
hcloud_location = "fsn1" hcloud_location = "fsn1"
hcloud_rescue = "linux64" hcloud_rescue = "linux64"
hcloud_initial_os = "ubuntu-22.04" hcloud_initial_os = "ubuntu-22.04"
flatcar_oem_id = "hetzner" flatcar_oem_id = "hetzner"
board = { board = {
x86 = "amd64" x86 = "amd64-usr"
arm = "arm64" arm = "arm64-usr"
} }
} }
source "hcloud" "flatcar" { source "hcloud" "flatcar" {
token = var.hcloud_token token = var.hcloud_token
image = local.hcloud_initial_os image = local.hcloud_initial_os
location = local.hcloud_location location = local.hcloud_location
rescue = local.hcloud_rescue rescue = local.hcloud_rescue
snapshot_labels = { snapshot_labels = {
os = "flatcar" os = "flatcar"
} }
ssh_username = "root" ssh_username = "root"
@ -65,14 +65,14 @@ source "hcloud" "flatcar" {
build { build {
source "hcloud.flatcar" { source "hcloud.flatcar" {
name = "x86" name = "x86"
server_type = var.hcloud_server_type["x86"] server_type = var.hcloud_server_type["x86"]
snapshot_name = "flatcar-x86" snapshot_name = "flatcar-x86"
} }
source "hcloud.flatcar" { source "hcloud.flatcar" {
name = "arm" name = "arm"
server_type = var.hcloud_server_type["arm"] server_type = var.hcloud_server_type["arm"]
snapshot_name = "flatcar-arm" snapshot_name = "flatcar-arm"
} }
@ -84,7 +84,7 @@ build {
"chmod +x flatcar-install", "chmod +x flatcar-install",
# Install flatcar # Install flatcar
"./flatcar-install -v -s -o hetzner -b ${var.image_base_url}/${local.board[source.name]} -V ${var.image_version_id}", "./flatcar-install -v -s -o hetzner -b https://${var.channel}.release.flatcar-linux.net/${local.board[source.name]} -V ${var.image_version_id}",
] ]
} }
} }