Skip to content

Commit

Permalink
azuread_conditional_access_policy: consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Sep 27, 2024
1 parent b384118 commit 5bb3f24
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,21 @@ func conditionalAccessPolicyResourceCreate(ctx context.Context, d *pluginsdk.Res
}

id := stable.NewIdentityConditionalAccessPolicyID(pointer.From(policy.Id))

// Consistency check
if err = consistency.WaitForUpdate(ctx, func(ctx context.Context) (*bool, error) {
resp, err := client.GetConditionalAccessPolicy(ctx, id, conditionalaccesspolicy.DefaultGetConditionalAccessPolicyOperationOptions())
if err != nil {
if response.WasNotFound(resp.HttpResponse) {
return pointer.To(false), nil
}
return pointer.To(false), err
}
return pointer.To(resp.Model != nil), nil
}); err != nil {
return tf.ErrorDiagF(err, "Waiting for creation of %s", id)
}

d.SetId(id.ID())

return conditionalAccessPolicyResourceRead(ctx, d, meta)
Expand Down

0 comments on commit 5bb3f24

Please sign in to comment.