Add project parameter to additional resources (#7828)
This commit is contained in:
parent
3392b3a764
commit
393863a5a9
|
@ -63,6 +63,13 @@ func resourceCloudStackLoadBalancerRule() *schema.Resource {
|
|||
ForceNew: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
},
|
||||
|
||||
"project": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +145,10 @@ func resourceCloudStackLoadBalancerRuleRead(d *schema.ResourceData, meta interfa
|
|||
cs := meta.(*cloudstack.CloudStackClient)
|
||||
|
||||
// Get the load balancer details
|
||||
lb, count, err := cs.LoadBalancer.GetLoadBalancerRuleByID(d.Id())
|
||||
lb, count, err := cs.LoadBalancer.GetLoadBalancerRuleByID(
|
||||
d.Id(),
|
||||
cloudstack.WithProject(d.Get("project").(string)),
|
||||
)
|
||||
if err != nil {
|
||||
if count == 0 {
|
||||
log.Printf("[DEBUG] Load balancer rule %s does no longer exist", d.Get("name").(string))
|
||||
|
@ -159,6 +169,8 @@ func resourceCloudStackLoadBalancerRuleRead(d *schema.ResourceData, meta interfa
|
|||
d.Set("network_id", lb.Networkid)
|
||||
}
|
||||
|
||||
setValueOrID(d, "project", lb.Project, lb.Projectid)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,13 @@ func resourceCloudStackStaticNAT() *schema.Resource {
|
|||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"project": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +84,10 @@ func resourceCloudStackStaticNATExists(d *schema.ResourceData, meta interface{})
|
|||
cs := meta.(*cloudstack.CloudStackClient)
|
||||
|
||||
// Get the IP address details
|
||||
ip, count, err := cs.Address.GetPublicIpAddressByID(d.Id())
|
||||
ip, count, err := cs.Address.GetPublicIpAddressByID(
|
||||
d.Id(),
|
||||
cloudstack.WithProject(d.Get("project").(string)),
|
||||
)
|
||||
if err != nil {
|
||||
if count == 0 {
|
||||
log.Printf("[DEBUG] IP address with ID %s no longer exists", d.Id())
|
||||
|
@ -94,7 +104,10 @@ func resourceCloudStackStaticNATRead(d *schema.ResourceData, meta interface{}) e
|
|||
cs := meta.(*cloudstack.CloudStackClient)
|
||||
|
||||
// Get the IP address details
|
||||
ip, count, err := cs.Address.GetPublicIpAddressByID(d.Id())
|
||||
ip, count, err := cs.Address.GetPublicIpAddressByID(
|
||||
d.Id(),
|
||||
cloudstack.WithProject(d.Get("project").(string)),
|
||||
)
|
||||
if err != nil {
|
||||
if count == 0 {
|
||||
log.Printf("[DEBUG] IP address with ID %s no longer exists", d.Id())
|
||||
|
@ -115,6 +128,8 @@ func resourceCloudStackStaticNATRead(d *schema.ResourceData, meta interface{}) e
|
|||
d.Set("virtual_machine_id", ip.Virtualmachineid)
|
||||
d.Set("vm_guest_ip", ip.Vmipaddress)
|
||||
|
||||
setValueOrID(d, "project", ip.Project, ip.Projectid)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ The following arguments are supported:
|
|||
* `member_ids` - (Required) List of instance IDs to assign to the load balancer
|
||||
rule. Changing this forces a new resource to be created.
|
||||
|
||||
* `project` - (Optional) The name or ID of the project to deploy this
|
||||
instance to. Changing this forces a new resource to be created.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
The following attributes are exported:
|
||||
|
|
|
@ -38,6 +38,9 @@ The following arguments are supported:
|
|||
forwarding rule (useful when the virtual machine has a secondairy NIC).
|
||||
Changing this forces a new resource to be created.
|
||||
|
||||
* `project` - (Optional) The name or ID of the project to deploy this
|
||||
instance to. Changing this forces a new resource to be created.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
The following attributes are exported:
|
||||
|
|
Loading…
Reference in New Issue