Skip to content

Commit c961e41

Browse files
committed
Another Formation DynoSize fix
1 parent a8138f0 commit c961e41

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

heroku/resource_heroku_formation.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ type formation struct {
2828
Client *heroku.Service // Client to interact with the heroku API
2929
}
3030

31-
type dynoSize struct {
32-
ID string `json:"id" url:"id,key"` // unique identifier of the dyno size
33-
Name string `json:"name" url:"name,key"` // name of the dyno size
34-
} `json:"dyno_size" url:"dyno_size,key"` // dyno size
35-
3631
func resourceHerokuFormation() *schema.Resource {
3732
return &schema.Resource{
3833
Create: resourceHerokuFormationCreate,
@@ -115,8 +110,12 @@ func resourceHerokuFormationCreate(d *schema.ResourceData, meta interface{}) err
115110
if v, ok := d.GetOk("size"); ok {
116111
vs := v.(string)
117112
log.Printf("[DEBUG] Size: %s", vs)
118-
ds := dynoSize{Name: &vs}
119-
opts.DynoSize = ds
113+
opts.DynoSize = &struct {
114+
ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of the dyno size
115+
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // name of the dyno size
116+
}{
117+
Name: &vs,
118+
}
120119
}
121120

122121
quantity := d.Get("quantity").(int)
@@ -145,8 +144,12 @@ func resourceHerokuFormationUpdate(d *schema.ResourceData, meta interface{}) err
145144
if d.HasChange("size") {
146145
v := d.Get("size").(string)
147146
log.Printf("[DEBUG] New Size: %s", v)
148-
ds := dynoSize{Name: &v}
149-
opts.DynoSize = ds
147+
opts.DynoSize = &struct {
148+
ID *string `json:"id,omitempty" url:"id,omitempty,key"` // unique identifier of the dyno size
149+
Name *string `json:"name,omitempty" url:"name,omitempty,key"` // name of the dyno size
150+
}{
151+
Name: &v,
152+
}
150153
}
151154

152155
if d.HasChange("quantity") {

0 commit comments

Comments
 (0)