From 85973ed8bee6bb6ca606b4ad03890b106ac4a21c Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Mon, 29 Jan 2024 13:12:49 -0600 Subject: [PATCH] omit vxlan in VLAN create request if the user didn't specify a value --- internal/resources/metal/vlan/resource.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/resources/metal/vlan/resource.go b/internal/resources/metal/vlan/resource.go index e943bd12a..ecca0defa 100644 --- a/internal/resources/metal/vlan/resource.go +++ b/internal/resources/metal/vlan/resource.go @@ -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") @@ -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)