DigitalOcean: Export droplet prices (#13720)
Note: In DO, Droplets are about the only thing you pay. DNS/Float IP are free. Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
74129323bd
commit
c2d1a37334
|
@ -63,6 +63,16 @@ func resourceDigitalOceanDroplet() *schema.Resource {
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"price_hourly": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
"price_monthly": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
|
||||||
"resize_disk": {
|
"resize_disk": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -259,6 +269,8 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
|
||||||
d.Set("name", droplet.Name)
|
d.Set("name", droplet.Name)
|
||||||
d.Set("region", droplet.Region.Slug)
|
d.Set("region", droplet.Region.Slug)
|
||||||
d.Set("size", droplet.Size.Slug)
|
d.Set("size", droplet.Size.Slug)
|
||||||
|
d.Set("price_hourly", droplet.Size.PriceHourly)
|
||||||
|
d.Set("price_monthly", droplet.Size.PriceMonthly)
|
||||||
d.Set("disk", droplet.Disk)
|
d.Set("disk", droplet.Disk)
|
||||||
d.Set("vcpus", droplet.Vcpus)
|
d.Set("vcpus", droplet.Vcpus)
|
||||||
d.Set("status", droplet.Status)
|
d.Set("status", droplet.Status)
|
||||||
|
|
|
@ -333,6 +333,14 @@ func testAccCheckDigitalOceanDropletAttributes(droplet *godo.Droplet) resource.T
|
||||||
return fmt.Errorf("Bad size_slug: %s", droplet.Size.Slug)
|
return fmt.Errorf("Bad size_slug: %s", droplet.Size.Slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if droplet.Size.PriceHourly != 0.00744 {
|
||||||
|
return fmt.Errorf("Bad price_hourly: %s", droplet.Size.PriceHourly)
|
||||||
|
}
|
||||||
|
|
||||||
|
if droplet.Size.PriceMonthly != 5.0 {
|
||||||
|
return fmt.Errorf("Bad price_monthly: %s", droplet.Size.PriceMonthly)
|
||||||
|
}
|
||||||
|
|
||||||
if droplet.Region.Slug != "nyc3" {
|
if droplet.Region.Slug != "nyc3" {
|
||||||
return fmt.Errorf("Bad region_slug: %s", droplet.Region.Slug)
|
return fmt.Errorf("Bad region_slug: %s", droplet.Region.Slug)
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,8 @@ The following attributes are exported:
|
||||||
* `ipv4_address_private` - The private networking IPv4 address
|
* `ipv4_address_private` - The private networking IPv4 address
|
||||||
* `locked` - Is the Droplet locked
|
* `locked` - Is the Droplet locked
|
||||||
* `private_networking` - Is private networking enabled
|
* `private_networking` - Is private networking enabled
|
||||||
|
* `price_hourly` - Droplet hourly price
|
||||||
|
* `price_monthly` - Droplet monthly price
|
||||||
* `size` - The instance size
|
* `size` - The instance size
|
||||||
* `disk` - The size of the instance's disk in GB
|
* `disk` - The size of the instance's disk in GB
|
||||||
* `vcpus` - The number of the instance's virtual CPUs
|
* `vcpus` - The number of the instance's virtual CPUs
|
||||||
|
|
Loading…
Reference in New Issue