Skip to content

Commit c626b10

Browse files
fix issue with catalystcenter_virtual_network_to_fabric_site DELETE method
1 parent f2eca64 commit c626b10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/provider/resource_catalystcenter_virtual_network_to_fabric_site.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (r *VirtualNetworkToFabricSiteResource) Delete(ctx context.Context, req res
257257
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString()))
258258

259259
MAX_RETRIES := 3
260-
for try := 0; try <= MAX_RETRIES; try++ {
260+
for try := 1; try <= MAX_RETRIES; try++ {
261261

262262
params := ""
263263
params += "?virtualNetworkName=" + url.QueryEscape(state.VirtualNetworkName.ValueString())
@@ -302,15 +302,15 @@ func (r *VirtualNetworkToFabricSiteResource) Delete(ctx context.Context, req res
302302

303303
getFabricIds := []string{}
304304
for _, id := range res.Get("response.0.fabricIds").Array() {
305-
existingFabricIds = append(existingFabricIds, id.String())
305+
getFabricIds = append(getFabricIds, id.String())
306306
}
307307
slices.Sort(newFabricIds)
308308
slices.Sort(getFabricIds)
309-
if slices.Equal(newFabricIds, existingFabricIds) {
309+
if slices.Equal(newFabricIds, getFabricIds) {
310310
break
311311
}
312312
if try != MAX_RETRIES {
313-
tflog.Warn(ctx, fmt.Sprintf("%s: Assigned fabric ids does not match. Retrying for %d time", res.String(), try))
313+
tflog.Warn(ctx, fmt.Sprintf("Assigned fabric ids does not match. Retrying for %d time(s). Response: %s", try, res.String()))
314314
} else {
315315
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Assigned fabric ids does not match. Please try again later, %s", res.String()))
316316
return

0 commit comments

Comments
 (0)