provider/openstack Convert FixedIPS from struct to map for ResourceData
This commit is contained in:
parent
3792bd6f6f
commit
17e6e5d118
|
@ -81,6 +81,7 @@ func resourceNetworkingPortV2() *schema.Resource {
|
|||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
ForceNew: false,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"subnet_id": &schema.Schema{
|
||||
|
@ -90,6 +91,7 @@ func resourceNetworkingPortV2() *schema.Resource {
|
|||
"ip_address": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -163,7 +165,16 @@ func resourceNetworkingPortV2Read(d *schema.ResourceData, meta interface{}) erro
|
|||
d.Set("device_owner", p.DeviceOwner)
|
||||
d.Set("security_group_ids", p.SecurityGroups)
|
||||
d.Set("device_id", p.DeviceID)
|
||||
d.Set("fixed_ip", p.FixedIPs)
|
||||
|
||||
// Convert FixedIPs to list of map
|
||||
var ips []map[string]interface{}
|
||||
for _, ipObject := range p.FixedIPs {
|
||||
ip := make(map[string]interface{})
|
||||
ip["subnet_id"] = ipObject.SubnetID
|
||||
ip["ip_address"] = ipObject.IPAddress
|
||||
ips = append(ips, ip)
|
||||
}
|
||||
d.Set("fixed_ip", ips)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -84,3 +84,4 @@ The following attributes are exported:
|
|||
* `device_owner` - See Argument Reference above.
|
||||
* `security_groups` - See Argument Reference above.
|
||||
* `device_id` - See Argument Reference above.
|
||||
* `fixed_ip/ip_address` - See Argument Reference above.
|
||||
|
|
Loading…
Reference in New Issue