mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
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,
|
||||
},
|
||||
|
||||
"price_hourly": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"price_monthly": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"resize_disk": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
@ -259,6 +269,8 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
|
||||
d.Set("name", droplet.Name)
|
||||
d.Set("region", droplet.Region.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("vcpus", droplet.Vcpus)
|
||||
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)
|
||||
}
|
||||
|
||||
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" {
|
||||
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
|
||||
* `locked` - Is the Droplet locked
|
||||
* `private_networking` - Is private networking enabled
|
||||
* `price_hourly` - Droplet hourly price
|
||||
* `price_monthly` - Droplet monthly price
|
||||
* `size` - The instance size
|
||||
* `disk` - The size of the instance's disk in GB
|
||||
* `vcpus` - The number of the instance's virtual CPUs
|
||||
|
Loading…
Reference in New Issue
Block a user