Only set projectID if it is set

This commit is contained in:
Hany Fahim 2015-10-05 18:59:52 -04:00
parent ea89339a43
commit d212b278a9
1 changed files with 4 additions and 1 deletions

View File

@ -161,7 +161,10 @@ func resourceCloudStackVPCRead(d *schema.ResourceData, meta interface{}) error {
p := cs.Address.NewListPublicIpAddressesParams()
p.SetVpcid(d.Id())
p.SetIssourcenat(true)
p.SetProjectid(v.Projectid)
if project, ok := d.GetOk("project"); ok {
p.SetProjectid(v.Projectid)
}
l, e := cs.Address.ListPublicIpAddresses(p)
if (e == nil) && (l.Count == 1) {
d.Set("source_nat_ip", l.PublicIpAddresses[0].Ipaddress)