use snapshots instead of hetzner images

main
Michael Wilson 3 years ago
parent b65658d120
commit 779e4fe6b2
  1. 8
      hcloud-k3s-cluster/main.tf
  2. 6
      hcloud-k3s-cluster/vars.tf

@ -31,7 +31,7 @@ resource "hcloud_ssh_key" "pubkey" {
resource "hcloud_server" "k3s-node" {
count = var.node_count
name = "k3s-node-${count.index + 1}"
image = var.image_name
image = data.hcloud_image.packer_snapshot.id
server_type = var.server_type
ssh_keys = [ "${hcloud_ssh_key.pubkey.id}" ]
location = var.server_location
@ -169,3 +169,9 @@ resource "hcloud_placement_group" "k3s-cluster-nodes" {
key = "value"
}
}
# packer snapshot
data "hcloud_image" "packer_snapshot" {
with_selector = var.snapshot_selector
most_recent = true
}

@ -14,10 +14,10 @@ variable "hetznerdns_token" {
description = "hetznerdns API token"
}
variable "image_name" {
variable "snapshot_selector" {
type = string
description = "hetzner cloud image name"
default = "ubuntu-22.04"
description = "snapshot selector for server creation"
default = "os-flavor=debian"
}
variable "node_count" {

Loading…
Cancel
Save