Add project parameter to cloudstack_ipaddress
This commit is contained in:
parent
228da7cf27
commit
078b16b20e
|
@ -32,6 +32,12 @@ func resourceCloudStackIPAddress() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"project": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +52,17 @@ func resourceCloudStackIPAddressCreate(d *schema.ResourceData, meta interface{})
|
|||
// Create a new parameter struct
|
||||
p := cs.Address.NewAssociateIpAddressParams()
|
||||
|
||||
// If there is a project supplied, we retreive and set the project id
|
||||
if project, ok := d.GetOk("project"); ok {
|
||||
// Retrieve the project UUID
|
||||
projectid, e := retrieveUUID(cs, "project", project.(string))
|
||||
if e != nil {
|
||||
return e.Error()
|
||||
}
|
||||
// Set the default project ID
|
||||
p.SetProjectid(projectid)
|
||||
}
|
||||
|
||||
if network, ok := d.GetOk("network"); ok {
|
||||
// Retrieve the network UUID
|
||||
networkid, e := retrieveUUID(cs, "network", network.(string))
|
||||
|
@ -118,6 +135,8 @@ func resourceCloudStackIPAddressRead(d *schema.ResourceData, meta interface{}) e
|
|||
setValueOrUUID(d, "vpc", v.Name, f.Vpcid)
|
||||
}
|
||||
|
||||
setValueOrUUID(d, "project", f.Project, f.Projectid)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue