From a447db4e3137e0f6c53eb0b87bac7221659aa3c7 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Wed, 10 Jul 2024 14:54:33 -0400 Subject: [PATCH] improve 404 handling in `apstra_datacenter_ip_link_addressing` resource --- apstra/resource_datacenter_ip_link_addressing.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apstra/resource_datacenter_ip_link_addressing.go b/apstra/resource_datacenter_ip_link_addressing.go index 8be7842e..1365137c 100644 --- a/apstra/resource_datacenter_ip_link_addressing.go +++ b/apstra/resource_datacenter_ip_link_addressing.go @@ -233,7 +233,7 @@ func (o *resourceDatacenterIpLinkAddressing) Read(ctx context.Context, req resou bp, err := o.getBpClientFunc(ctx, state.BlueprintId.ValueString()) if err != nil { if utils.IsApstra404(err) { - resp.Diagnostics.AddError(fmt.Sprintf("Blueprint %s not found", state.BlueprintId), err.Error()) + resp.State.RemoveResource(ctx) return } resp.Diagnostics.AddError("Failed to create Blueprint client", err.Error()) @@ -272,7 +272,7 @@ func (o *resourceDatacenterIpLinkAddressing) Update(ctx context.Context, req res bp, err := o.getBpClientFunc(ctx, plan.BlueprintId.ValueString()) if err != nil { if utils.IsApstra404(err) { - resp.State.RemoveResource(ctx) + resp.Diagnostics.AddError(fmt.Sprintf("Blueprint %s not found", plan.BlueprintId), err.Error()) return } resp.Diagnostics.AddError("failed to create blueprint client", err.Error())