diff --git a/cloudstack/resource_cloudstack_network.go b/cloudstack/resource_cloudstack_network.go index 3a92dcc6..1aebe76e 100644 --- a/cloudstack/resource_cloudstack_network.go +++ b/cloudstack/resource_cloudstack_network.go @@ -204,6 +204,12 @@ func resourceCloudStackNetwork() *schema.Resource { ForceNew: true, }, + "bypass_vlan_overlap_check": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "tags": tagsSchema(), }, } @@ -296,6 +302,11 @@ func resourceCloudStackNetworkCreate(d *schema.ResourceData, meta interface{}) e p.SetVlan(strconv.Itoa(vlan.(int))) } + // Bypass VLAN overlap check if necessary + if bypassVlanOverlapCheck, ok := d.GetOk("bypass_vlan_overlap_check"); ok { + p.SetBypassvlanoverlapcheck(bypassVlanOverlapCheck.(bool)) + } + // Check is this network needs to be created in a VPC if vpcid, ok := d.GetOk("vpc_id"); ok { // Set the vpc id diff --git a/cloudstack/resource_cloudstack_network_test.go b/cloudstack/resource_cloudstack_network_test.go index 044ac889..6fc82ac5 100644 --- a/cloudstack/resource_cloudstack_network_test.go +++ b/cloudstack/resource_cloudstack_network_test.go @@ -171,9 +171,10 @@ func TestAccCloudStackNetwork_import(t *testing.T) { }, { - ResourceName: "cloudstack_network.foo", - ImportState: true, - ImportStateVerify: true, + ResourceName: "cloudstack_network.foo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"bypass_vlan_overlap_check"}, }, }, }) @@ -190,10 +191,11 @@ func TestAccCloudStackNetwork_importProject(t *testing.T) { }, { - ResourceName: "cloudstack_network.foo", - ImportState: true, - ImportStateIdPrefix: "terraform/", - ImportStateVerify: true, + ResourceName: "cloudstack_network.foo", + ImportState: true, + ImportStateIdPrefix: "terraform/", + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"bypass_vlan_overlap_check"}, }, }, }) diff --git a/website/docs/r/network.html.markdown b/website/docs/r/network.html.markdown index 72f6d568..4adae633 100644 --- a/website/docs/r/network.html.markdown +++ b/website/docs/r/network.html.markdown @@ -126,7 +126,7 @@ The following arguments are supported: * `zone` - (Required) The name or ID of the zone where this network will be available. Changing this forces a new resource to be created. -* `bypass_vlan_check` - (Optional) if set to `true` it bypasses VLAN id/range overlap +* `bypass_vlan_overlap_check` - (Optional) if set to `true` it bypasses VLAN id/range overlap check during network creation for shared and L2 networks