builder/digitalocean: Add logging of Droplet create attributes.

This commit is contained in:
Andrew Starr-Bochicchio 2020-05-12 12:38:51 -04:00
parent 80b4e0425e
commit 374a29d75c
1 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package digitalocean
import (
"context"
"fmt"
"log"
"strconv"
"io/ioutil"
@ -43,7 +44,7 @@ func (s *stepCreateDroplet) Run(ctx context.Context, state multistep.StateBag) m
createImage = godo.DropletCreateImage{ID: imageId}
}
droplet, _, err := client.Droplets.Create(context.TODO(), &godo.DropletCreateRequest{
dropletCreateReq := &godo.DropletCreateRequest{
Name: c.DropletName,
Region: c.Region,
Size: c.Size,
@ -56,7 +57,11 @@ func (s *stepCreateDroplet) Run(ctx context.Context, state multistep.StateBag) m
IPv6: c.IPv6,
UserData: userData,
Tags: c.Tags,
})
}
log.Printf("[DEBUG] Droplet create paramaters: %s", godo.Stringify(dropletCreateReq))
droplet, _, err := client.Droplets.Create(context.TODO(), dropletCreateReq)
if err != nil {
err := fmt.Errorf("Error creating droplet: %s", err)
state.Put("error", err)