Skip to content

Commit

Permalink
fix logic to look at null_when_not_found
Browse files Browse the repository at this point in the history
  • Loading branch information
bwJuniper committed Oct 30, 2024
1 parent 2b696be commit 8ff84d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apstra/blueprint/node_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand All @@ -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()))
Expand Down

0 comments on commit 8ff84d3

Please sign in to comment.