Skip to content

Commit

Permalink
fix: process prefix search errors
Browse files Browse the repository at this point in the history
  • Loading branch information
agrrh committed Mar 12, 2024
1 parent f278029 commit a002db8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/provider/allocation_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ func (r *AllocationResource) Read(ctx context.Context, req resource.ReadRequest,
return
}

parentPrefix := r.ipam.PrefixFrom(ctx, data.PoolId.ValueString())
parentPrefix, err := r.ipam.PrefixFrom(ctx, data.PoolId.ValueString())

if parentPrefix == nil {
if err != nil || parentPrefix == nil {
return
}

Expand Down
6 changes: 5 additions & 1 deletion internal/provider/pool_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func (r *PoolResource) Read(ctx context.Context, req resource.ReadRequest, resp
return
}

prefix := r.ipam.PrefixFrom(ctx, data.CIDR.ValueString())
prefix, err := r.ipam.PrefixFrom(ctx, data.CIDR.ValueString())

if err != nil {
return
}

if prefix != nil {
data.CIDR = types.StringValue(prefix.Cidr)
Expand Down
Binary file added terraform-provider-ipam
Binary file not shown.

0 comments on commit a002db8

Please sign in to comment.