diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3140f1d..100b2372a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ NOTES: * update the provider dependency on the terraform SDK 2 to the release v2.24.1 * update the go release to use the 1.18 +BUG FIXES: + +* For virtual network resource type `ovswitch` attributes `vlan_id` and `automatic_vlan_id` are optional + # 1.1.1 (January 30th, 2023) BUG FIXES: diff --git a/opennebula/resource_opennebula_virtual_network.go b/opennebula/resource_opennebula_virtual_network.go index b07a63e51..431de065d 100644 --- a/opennebula/resource_opennebula_virtual_network.go +++ b/opennebula/resource_opennebula_virtual_network.go @@ -406,9 +406,8 @@ func changeVNetGroup(d *schema.ResourceData, meta interface{}) error { return nil } -func validVlanType(intype string) int { - vlanType := []string{"802.1Q", "vxlan", "ovswitch"} - return inArray(intype, vlanType) +func mandatoryVLAN(intype string) bool { + return inArray(intype, []string{"802.1Q", "vxlan"}) >= 0 } func resourceOpennebulaVirtualNetworkCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { @@ -804,7 +803,7 @@ func generateVn(d *schema.ResourceData) (string, error) { tpl.Add(vnk.Name, vnname) tpl.Add(vnk.VNMad, vnmad) - if validVlanType(vnmad) >= 0 { + if mandatoryVLAN(vnmad) { if d.Get("automatic_vlan_id") == true { tpl.Add("AUTOMATIC_VLAN_ID", "YES") } else if vlanid, ok := d.GetOk("vlan_id"); ok {