Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/services/applications/application_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,7 @@ func applicationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, m

// Attempt to patch the newly created application and set the display name, which will tell us whether it exists yet, then set it back to the desired value.
// The SDK handles retries for us here in the event of 404, 429 or 5xx, then returns after giving up.
// Due to an unusual implementation on this service, the retry function also retries on 409. See https://github.com/hashicorp/terraform-provider-azuread/issues/1764#issuecomment-3282278691 for more information.
uid, err := uuid.GenerateUUID()
if err != nil {
return tf.ErrorDiagF(err, "Failed to generate a UUID")
Expand Down
3 changes: 2 additions & 1 deletion internal/services/applications/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (

func applicationUpdateRetryFunc() client.RequestRetryFunc {
return func(resp *http.Response, o *odata.OData) (bool, error) {
if response.WasNotFound(resp) {
// inconsistent state on this resource can result in a 409 Conflict being returned, in this exception case we retry as per the service design, see https://github.com/hashicorp/terraform-provider-azuread/issues/1764#issuecomment-3282278691 for more information.
if response.WasNotFound(resp) || response.WasConflict(resp) {
return true, nil
} else if response.WasBadRequest(resp) && o != nil && o.Error != nil {
return o.Error.Match("Permission (scope or role) cannot be deleted or updated unless disabled first"), nil
Expand Down
Loading