Skip to content

Commit

Permalink
B #405: create ovs network without vlan id
Browse files Browse the repository at this point in the history
  • Loading branch information
treywelsh committed Feb 13, 2023
1 parent 0a97ac7 commit 9601fb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions opennebula/resource_opennebula_virtual_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 9601fb4

Please sign in to comment.