aboutsummaryrefslogtreecommitdiffstats
path: root/hcloud-snapshot/main.pkr.hcl
diff options
context:
space:
mode:
Diffstat (limited to 'hcloud-snapshot/main.pkr.hcl')
-rw-r--r--hcloud-snapshot/main.pkr.hcl22
1 files changed, 22 insertions, 0 deletions
diff --git a/hcloud-snapshot/main.pkr.hcl b/hcloud-snapshot/main.pkr.hcl
new file mode 100644
index 0000000..920eeae
--- /dev/null
+++ b/hcloud-snapshot/main.pkr.hcl
@@ -0,0 +1,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",
+ ]
+ }
+}