From df7bb1cc83cd44d015f9d5c48629eed0a0c2dc92 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Mon, 20 May 2024 17:34:04 -0400 Subject: [PATCH] eliminate unnecessary `newState` object from routing zone resource `Read()` --- apstra/resource_datacenter_routing_zone.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/apstra/resource_datacenter_routing_zone.go b/apstra/resource_datacenter_routing_zone.go index f45b7269..19e77301 100644 --- a/apstra/resource_datacenter_routing_zone.go +++ b/apstra/resource_datacenter_routing_zone.go @@ -202,14 +202,8 @@ func (o *resourceDatacenterRoutingZone) Read(ctx context.Context, req resource.R return } - // create a new state object with relevant values copied from prior state - var newState blueprint.DatacenterRoutingZone - newState.Id = state.Id - newState.HadPriorVlanIdConfig = state.HadPriorVlanIdConfig - newState.HadPriorVniConfig = state.HadPriorVniConfig - // read the current status from the API - err = newState.Read(ctx, bp, &resp.Diagnostics) + err = state.Read(ctx, bp, &resp.Diagnostics) if err != nil { if utils.IsApstra404(err) { resp.State.RemoveResource(ctx) @@ -217,7 +211,7 @@ func (o *resourceDatacenterRoutingZone) Read(ctx context.Context, req resource.R } resp.Diagnostics.AddError( - fmt.Sprintf("failed while reading blueprint %s routing zone %s details", bp.Id(), newState.Id), + fmt.Sprintf("failed while reading blueprint %s routing zone %s details", bp.Id(), state.Id), err.Error()) } if resp.Diagnostics.HasError() {