From 5a7944f21504e1636c93d9f579b88392bb0ab9a0 Mon Sep 17 00:00:00 2001 From: Roman Ryzhyi Date: Fri, 20 Oct 2023 16:26:07 +0300 Subject: [PATCH] feat: Add HCP Packer support --- builder/hcloud/artifact.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builder/hcloud/artifact.go b/builder/hcloud/artifact.go index 27783050..be270874 100644 --- a/builder/hcloud/artifact.go +++ b/builder/hcloud/artifact.go @@ -6,6 +6,7 @@ package hcloud import ( "context" "fmt" + registryimage "github.com/hashicorp/packer-plugin-sdk/packer/registry/image" "log" "strconv" @@ -44,6 +45,14 @@ func (a *Artifact) String() string { } func (a *Artifact) State(name string) interface{} { + if name == registryimage.ArtifactStateURI { + img, err := registryimage.FromArtifact(a, registryimage.WithProvider("hetznercloud")) + if err != nil { + log.Printf("[DEBUG] error encountered when creating a registry image %v", err) + return nil + } + return img + } return a.StateData[name] }