diff --git a/internal/provider/resource_ko_build.go b/internal/provider/resource_ko_build.go index 5fadb29..fa8e877 100644 --- a/internal/provider/resource_ko_build.go +++ b/internal/provider/resource_ko_build.go @@ -253,7 +253,7 @@ func fromData(d *schema.ResourceData, po *Opts) buildOptions { ip: d.Get("importpath").(string), workingDir: d.Get("working_dir").(string), imageRepo: repo, - platforms: toStringSlice(d.Get("platforms").([]interface{})), + platforms: defaultPlatform(toStringSlice(d.Get("platforms").([]interface{}))), baseImage: d.Get("base_image").(string), sbom: d.Get("sbom").(string), auth: po.auth, @@ -262,11 +262,14 @@ func fromData(d *schema.ResourceData, po *Opts) buildOptions { } } -func toStringSlice(in []interface{}) []string { +func defaultPlatform(in []string) []string { if len(in) == 0 { return []string{"linux/amd64"} } + return in +} +func toStringSlice(in []interface{}) []string { out := make([]string, len(in)) for i, ii := range in { if s, ok := ii.(string); ok {