aboutsummaryrefslogtreecommitdiffstats
path: root/hcloud-snapshot/main.pkr.hcl
blob: a78dd7360bcf09c74ae9835e23b5f21b9a792ad1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
packer {
  required_plugins {
    hcloud = { source = "github.com/hetznercloud/hcloud", version = "~> 1" }
  }
}

build {
  sources = ["source.hcloud.openbsd"]

  provisioner "file" {
    source      = var.image_path
    destination = "/tmp/openbsd.raw.zst"
  }

  provisioner "shell" {
    inline = [
      "which zstd || apt-get install --assume-yes zstd",
      "zstd --decompress --stdout /tmp/openbsd.raw.zst | dd of=/dev/sda bs=4M status=progress",
      "sync",
    ]
  }
}