From f0e01fd7695361d21448c76dba43f28797a87b9d Mon Sep 17 00:00:00 2001 From: Benjamin Zores Date: Fri, 29 Sep 2023 16:40:40 +0200 Subject: [PATCH] adapter: find real subnet id if a string was provided (e.g. public adapter) --- internal/provider/kowabunga_adapter_resource.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/provider/kowabunga_adapter_resource.go b/internal/provider/kowabunga_adapter_resource.go index 3ccd9f4..3aeb9a6 100644 --- a/internal/provider/kowabunga_adapter_resource.go +++ b/internal/provider/kowabunga_adapter_resource.go @@ -178,7 +178,13 @@ func ipv4MaskString(m []byte) string { } func (r *AdapterResource) GetSubnetData(data *AdapterResourceModel) error { - params := subnet.NewGetSubnetParams().WithSubnetID(data.Subnet.ValueString()) + // find real subnet id if a string was provided + subnetId, err := getSubnetID(r.Data, data.Subnet.ValueString()) + if err != nil { + return err + } + + params := subnet.NewGetSubnetParams().WithSubnetID(subnetId) obj, err := r.Data.K.Subnet.GetSubnet(params, nil) if err != nil { return err