aboutsummaryrefslogtreecommitdiffstats
path: root/hcloud-snapshot/main.pkr.hcl
blob: 920eeae37c2b78d209cc05d5ba919b20ea9fc0d3 (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",
    ]
  }
}