From 8ff84d341009271351ba0b6fffd136baf3acab93 Mon Sep 17 00:00:00 2001 From: bwjuniper Date: Wed, 30 Oct 2024 13:01:01 -0700 Subject: [PATCH] fix logic to look at null_when_not_found --- apstra/blueprint/node_system.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apstra/blueprint/node_system.go b/apstra/blueprint/node_system.go index 4d0b1a7a..a6f7f577 100644 --- a/apstra/blueprint/node_system.go +++ b/apstra/blueprint/node_system.go @@ -79,6 +79,9 @@ func (o *NodeTypeSystem) AttributesFromApi(ctx context.Context, client *apstra.C case !o.Id.IsNull(): desiredNode, ok = nodeResponse.Nodes[o.Id.ValueString()] if !ok { + if o.NullWhenNotFound.ValueBool() { + o.Attributes = types.ObjectNull(NodeTypeSystemAttributes{}.AttrTypes()) + } diags.AddError("Node not found", fmt.Sprintf("Node with ID %q not found in blueprint %q", o.Id.ValueString(), o.BlueprintId.ValueString())) @@ -92,6 +95,9 @@ func (o *NodeTypeSystem) AttributesFromApi(ctx context.Context, client *apstra.C } } if !ok { + if o.NullWhenNotFound.ValueBool() { + o.Attributes = types.ObjectNull(NodeTypeSystemAttributes{}.AttrTypes()) + } diags.AddError("Node not found", fmt.Sprintf("Node with Name %q not found in blueprint %q", o.Name.ValueString(), o.BlueprintId.ValueString()))