From 5a1f8097a0b31ea90bbea45f697d676376301052 Mon Sep 17 00:00:00 2001 From: Yukihiko SAWANOBORI Date: Tue, 21 Mar 2017 20:02:38 +0900 Subject: [PATCH] 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. --- .../cloudstack/resource_cloudstack_ipaddress.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/builtin/providers/cloudstack/resource_cloudstack_ipaddress.go b/builtin/providers/cloudstack/resource_cloudstack_ipaddress.go index ffee80f4a0..9bdd4ab4a7 100644 --- a/builtin/providers/cloudstack/resource_cloudstack_ipaddress.go +++ b/builtin/providers/cloudstack/resource_cloudstack_ipaddress.go @@ -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