Add project parameter to cloudstack_port_forward.
- Add parameter to resource. - Modify read operation to pass in projectid if defined.
This commit is contained in:
parent
5136462cda
commit
44fc1b5d80
|
@ -43,6 +43,12 @@ func resourceCloudStackPortForward() *schema.Resource {
|
||||||
Default: false,
|
Default: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"project": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
|
|
||||||
"forward": &schema.Schema{
|
"forward": &schema.Schema{
|
||||||
Type: schema.TypeSet,
|
Type: schema.TypeSet,
|
||||||
Required: true,
|
Required: true,
|
||||||
|
@ -207,6 +213,17 @@ func resourceCloudStackPortForwardRead(d *schema.ResourceData, meta interface{})
|
||||||
p.SetIpaddressid(d.Id())
|
p.SetIpaddressid(d.Id())
|
||||||
p.SetListall(true)
|
p.SetListall(true)
|
||||||
|
|
||||||
|
// If there is a project supplied, we retrieve and set the project id
|
||||||
|
if project, ok := d.GetOk("project"); ok {
|
||||||
|
// Retrieve the project ID
|
||||||
|
projectid, e := retrieveID(cs, "project", project.(string))
|
||||||
|
if e != nil {
|
||||||
|
return e.Error()
|
||||||
|
}
|
||||||
|
// Set the default project ID
|
||||||
|
p.SetProjectid(projectid)
|
||||||
|
}
|
||||||
|
|
||||||
l, err := cs.Firewall.ListPortForwardingRules(p)
|
l, err := cs.Firewall.ListPortForwardingRules(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue