Skip to content

Commit

Permalink
feat: support hashicorp cloud platform (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax committed Feb 1, 2023
1 parent d3f56be commit 0ff09c8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions builder/scaleway/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"

registryimage "github.com/hashicorp/packer-plugin-sdk/packer/registry/image"
"github.com/scaleway/scaleway-sdk-go/api/instance/v1"
"github.com/scaleway/scaleway-sdk-go/scw"
)
Expand Down Expand Up @@ -51,6 +52,18 @@ func (a *Artifact) String() string {
}

func (a *Artifact) State(name string) interface{} {
if name == registryimage.ArtifactStateURI {
img, err := registryimage.FromArtifact(a,
registryimage.WithID(a.imageID),
registryimage.WithProvider("scaleway"),
registryimage.WithRegion(a.zoneName),
)
if err != nil {
log.Printf("error when creating hcp registry image %v", err)
return nil
}
return img
}
return a.StateData[name]
}

Expand Down

0 comments on commit 0ff09c8

Please sign in to comment.