Merge pull request #3337 from svanharmelen/f-cloudstack-nwdomain
provider/cloudstack: add support for network domains
This commit is contained in:
commit
99aeec07de
|
@ -40,6 +40,12 @@ func resourceCloudStackVPC() *schema.Resource {
|
|||
ForceNew: true,
|
||||
},
|
||||
|
||||
"network_domain": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"project": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
|
@ -79,7 +85,19 @@ func resourceCloudStackVPCCreate(d *schema.ResourceData, meta interface{}) error
|
|||
}
|
||||
|
||||
// Create a new parameter struct
|
||||
p := cs.VPC.NewCreateVPCParams(d.Get("cidr").(string), displaytext.(string), name, vpcofferingid, zoneid)
|
||||
p := cs.VPC.NewCreateVPCParams(
|
||||
d.Get("cidr").(string),
|
||||
displaytext.(string),
|
||||
name,
|
||||
vpcofferingid,
|
||||
zoneid,
|
||||
)
|
||||
|
||||
// If there is a network domain supplied, make sure to add it to the request
|
||||
if networkDomain, ok := d.GetOk("network_domain"); ok {
|
||||
// Set the network domain
|
||||
p.SetNetworkdomain(networkDomain.(string))
|
||||
}
|
||||
|
||||
// If there is a project supplied, we retrieve and set the project id
|
||||
if project, ok := d.GetOk("project"); ok {
|
||||
|
@ -122,6 +140,7 @@ func resourceCloudStackVPCRead(d *schema.ResourceData, meta interface{}) error {
|
|||
d.Set("name", v.Name)
|
||||
d.Set("display_text", v.Displaytext)
|
||||
d.Set("cidr", v.Cidr)
|
||||
d.Set("network_domain", v.Networkdomain)
|
||||
|
||||
// Get the VPC offering details
|
||||
o, _, err := cs.VPC.GetVPCOfferingByID(v.Vpcofferingid)
|
||||
|
|
|
@ -76,6 +76,10 @@ func testAccCheckCloudStackVPCAttributes(
|
|||
return fmt.Errorf("Bad VPC CIDR: %s", vpc.Cidr)
|
||||
}
|
||||
|
||||
if vpc.Networkdomain != "terraform-domain" {
|
||||
return fmt.Errorf("Bad network domain: %s", vpc.Networkdomain)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +111,7 @@ resource "cloudstack_vpc" "foo" {
|
|||
display_text = "terraform-vpc-text"
|
||||
cidr = "%s"
|
||||
vpc_offering = "%s"
|
||||
network_domain = "terraform-domain"
|
||||
zone = "%s"
|
||||
}`,
|
||||
CLOUDSTACK_VPC_CIDR_1,
|
||||
|
|
Loading…
Reference in New Issue