Add params zone_id to cloudstack ipaddress resource (#11306)

* add option zone_id

- Ref: http://docs.idcf.jp/cloud/api/address/#listpublicipaddresses

* Exclusion of `network_id`, `vpc_id` and `zone_id`

* Revert "Exclusion of `network_id`, `vpc_id` and `zone_id`"

This reverts commit 9684c8b0b65b3353aea4e0bfbeaf21986282812b.

* remove zone_id from one of required option.
This commit is contained in:
Yukihiko SAWANOBORI 2017-03-21 20:02:38 +09:00 committed by Sander van Harmelen
parent c217c6c0c4
commit 5a1f8097a0
1 changed files with 15 additions and 0 deletions

View File

@ -28,6 +28,12 @@ func resourceCloudStackIPAddress() *schema.Resource {
ForceNew: true,
},
"zone_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -63,6 +69,11 @@ func resourceCloudStackIPAddressCreate(d *schema.ResourceData, meta interface{})
p.SetVpcid(vpcid.(string))
}
if zoneid, ok := d.GetOk("zone_id"); ok {
// Set the vpcid
p.SetZoneid(zoneid.(string))
}
// If there is a project supplied, we retrieve and set the project id
if err := setProjectid(p, cs, d); err != nil {
return err
@ -109,6 +120,10 @@ func resourceCloudStackIPAddressRead(d *schema.ResourceData, meta interface{}) e
d.Set("vpc_id", ip.Vpcid)
}
if _, ok := d.GetOk("zone_id"); ok {
d.Set("zone_id", ip.Zoneid)
}
setValueOrID(d, "project", ip.Project, ip.Projectid)
return nil