Merge pull request #9551 from fatmcgav/openstack_networking_port_add_value_specs
provider/openstack: Add value_specs option to `openstack_networking_port_v2`
This commit is contained in:
commit
1d6695139d
|
@ -115,6 +115,11 @@ func resourceNetworkingPortV2() *schema.Resource {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"value_specs": &schema.Schema{
|
||||||
|
Type: schema.TypeMap,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +131,8 @@ func resourceNetworkingPortV2Create(d *schema.ResourceData, meta interface{}) er
|
||||||
return fmt.Errorf("Error creating OpenStack networking client: %s", err)
|
return fmt.Errorf("Error creating OpenStack networking client: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
createOpts := ports.CreateOpts{
|
createOpts := PortCreateOpts{
|
||||||
|
ports.CreateOpts{
|
||||||
Name: d.Get("name").(string),
|
Name: d.Get("name").(string),
|
||||||
AdminStateUp: resourcePortAdminStateUpV2(d),
|
AdminStateUp: resourcePortAdminStateUpV2(d),
|
||||||
NetworkID: d.Get("network_id").(string),
|
NetworkID: d.Get("network_id").(string),
|
||||||
|
@ -137,6 +143,8 @@ func resourceNetworkingPortV2Create(d *schema.ResourceData, meta interface{}) er
|
||||||
DeviceID: d.Get("device_id").(string),
|
DeviceID: d.Get("device_id").(string),
|
||||||
FixedIPs: resourcePortFixedIpsV2(d),
|
FixedIPs: resourcePortFixedIpsV2(d),
|
||||||
AllowedAddressPairs: resourceAllowedAddressPairsV2(d),
|
AllowedAddressPairs: resourceAllowedAddressPairsV2(d),
|
||||||
|
},
|
||||||
|
MapValueSpecs(d),
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[DEBUG] Create Options: %#v", createOpts)
|
log.Printf("[DEBUG] Create Options: %#v", createOpts)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package openstack
|
||||||
import (
|
import (
|
||||||
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
|
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers"
|
||||||
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
|
"github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
|
||||||
|
"github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
|
||||||
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
|
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,6 +19,18 @@ func (opts NetworkCreateOpts) ToNetworkCreateMap() (map[string]interface{}, erro
|
||||||
return BuildRequest(opts, "network")
|
return BuildRequest(opts, "network")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PortCreateOpts represents the attributes used when creating a new port.
|
||||||
|
type PortCreateOpts struct {
|
||||||
|
ports.CreateOpts
|
||||||
|
ValueSpecs map[string]string `json:"value_specs,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToPortCreateMap casts a CreateOpts struct to a map.
|
||||||
|
// It overrides ports.ToPortCreateMap to add the ValueSpecs field.
|
||||||
|
func (opts PortCreateOpts) ToPortCreateMap() (map[string]interface{}, error) {
|
||||||
|
return BuildRequest(opts, "port")
|
||||||
|
}
|
||||||
|
|
||||||
// RouterCreateOpts represents the attributes used when creating a new router.
|
// RouterCreateOpts represents the attributes used when creating a new router.
|
||||||
type RouterCreateOpts struct {
|
type RouterCreateOpts struct {
|
||||||
routers.CreateOpts
|
routers.CreateOpts
|
||||||
|
|
|
@ -67,6 +67,8 @@ The following arguments are supported:
|
||||||
addresses that can be active on this port. The structure is described
|
addresses that can be active on this port. The structure is described
|
||||||
below.
|
below.
|
||||||
|
|
||||||
|
* `value_specs` - (Optional) Map of additional options.
|
||||||
|
|
||||||
The `fixed_ip` block supports:
|
The `fixed_ip` block supports:
|
||||||
|
|
||||||
* `subnet_id` - (Required) Subnet in which to allocate IP address for
|
* `subnet_id` - (Required) Subnet in which to allocate IP address for
|
||||||
|
|
Loading…
Reference in New Issue