Skip to content

Commit

Permalink
r/app_configuration: handling the PurgeDeleted method returning a 404…
Browse files Browse the repository at this point in the history
… instead of an LRO
  • Loading branch information
tombuildsstuff committed May 8, 2023
1 parent 3fd7fbf commit 3c189d6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,16 @@ func resourceAppConfigurationDelete(d *pluginsdk.ResourceData, meta interface{})
}

log.Printf("[DEBUG] %q marked for purge - executing purge", id.ConfigurationStoreName)
if err := deletedConfigurationStoresClient.ConfigurationStoresPurgeDeletedThenPoll(ctx, deletedId); err != nil {
poller, err := deletedConfigurationStoresClient.ConfigurationStoresPurgeDeleted(ctx, deletedId)
if err != nil {
return fmt.Errorf("purging %s: %+v", *id, err)
}
// NOTE: the PurgeDeleted method is a POST which eventually returns a 404 from the LRO, so we need to handle that
if err := poller.Poller.PollUntilDone(ctx); err != nil {
if resp := poller.Poller.LatestResponse(); resp == nil || !response.WasNotFound(resp.Response) {
return fmt.Errorf("polling after purging for %s: %+v", *id, err)
}
}

// TODO: retry checkNameAvailability after deletion when SDK is ready, see https://github.com/Azure/AppConfiguration/issues/677
log.Printf("[DEBUG] Purged AppConfiguration %q.", id.ConfigurationStoreName)
Expand Down

0 comments on commit 3c189d6

Please sign in to comment.