Skip to content

Commit

Permalink
omit vxlan in VLAN create request if the user didn't specify a value
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Feb 1, 2024
1 parent b1d9b84 commit 85973ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/resources/metal/vlan/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func resourceMetalVlanCreate(ctx context.Context, d *schema.ResourceData, meta i

//facRaw, facOk := d.GetOk("facility")
metroRaw, metroOk := d.GetOk("metro")
vxlanRaw, _ := d.GetOk("vxlan")
vxlanRaw, vxlanOk := d.GetOk("vxlan")

if /*!facOk &&*/ !metroOk {
return diag.Errorf("one of facility or metro must be configured")
Expand All @@ -102,7 +102,9 @@ func resourceMetalVlanCreate(ctx context.Context, d *schema.ResourceData, meta i
}
if metroOk {
createRequest.Metro = metalv1.PtrString(metroRaw.(string))
createRequest.Vxlan = metalv1.PtrInt32(int32(vxlanRaw.(int)))
if vxlanOk {
createRequest.Vxlan = metalv1.PtrInt32(int32(vxlanRaw.(int)))
}
}
/*if facOk {
createRequest.Facility = facRaw.(string)
Expand Down

0 comments on commit 85973ed

Please sign in to comment.