From 1de2fde147558fc10600638c29e9340651424d14 Mon Sep 17 00:00:00 2001 From: Cliff Pracht Date: Thu, 7 Jan 2016 09:55:43 -0500 Subject: [PATCH] Fix to not put fixed_ip in request if not defined --- .../openstack/resource_openstack_networking_port_v2.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/builtin/providers/openstack/resource_openstack_networking_port_v2.go b/builtin/providers/openstack/resource_openstack_networking_port_v2.go index 0b8d33ad5ab9..46565d26d9d6 100644 --- a/builtin/providers/openstack/resource_openstack_networking_port_v2.go +++ b/builtin/providers/openstack/resource_openstack_networking_port_v2.go @@ -245,8 +245,13 @@ func resourcePortSecurityGroupsV2(d *schema.ResourceData) []string { return groups } -func resourcePortFixedIpsV2(d *schema.ResourceData) []ports.IP { +func resourcePortFixedIpsV2(d *schema.ResourceData) interface{} { rawIP := d.Get("fixed_ip").([]interface{}) + + if len(rawIP) == 0 { + return nil + } + ip := make([]ports.IP, len(rawIP)) for i, raw := range rawIP { rawMap := raw.(map[string]interface{}) @@ -255,8 +260,8 @@ func resourcePortFixedIpsV2(d *schema.ResourceData) []ports.IP { IPAddress: rawMap["ip_address"].(string), } } - return ip + } func resourcePortAdminStateUpV2(d *schema.ResourceData) *bool {