Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_app_configuration_{key|feature} - prelong wait time for the role permission to be done propagated #21337

Merged
merged 3 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,25 @@ func (k FeatureResource) Create() sdk.ResourceFunc {
}
featureKey := fmt.Sprintf("%s/%s", FeatureKeyPrefix, rawKey)

nestedItemId, err := parse.NewNestedItemID(client.Endpoint, featureKey, model.Label)
if err != nil {
return err
}

deadline, ok := ctx.Deadline()
if !ok {
return fmt.Errorf("could not determine context deadline for create for %s", nestedItemId)
teowa marked this conversation as resolved.
Show resolved Hide resolved
teowa marked this conversation as resolved.
Show resolved Hide resolved
}

// from https://learn.microsoft.com/en-us/azure/azure-app-configuration/concept-enable-rbac#azure-built-in-roles-for-azure-app-configuration
// allow up to 15 min for role permission to be done propagated
// allow some time for role permission to be done propagated
metadata.Logger.Infof("[DEBUG] Waiting for App Configuration Key %q read permission to be done propagated", featureKey)
stateConf := &pluginsdk.StateChangeConf{
Pending: []string{"Forbidden"},
Target: []string{"Error", "Exists"},
Refresh: appConfigurationGetKeyRefreshFunc(ctx, client, featureKey, model.Label),
PollInterval: 20 * time.Second,
Timeout: 15 * time.Minute,
}

nestedItemId, err := parse.NewNestedItemID(client.Endpoint, featureKey, model.Label)
if err != nil {
return err
Timeout: time.Until(deadline),
}

if _, err = stateConf.WaitForStateContext(ctx); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,20 @@ func (k KeyResource) Create() sdk.ResourceFunc {
return err
}

deadline, ok := ctx.Deadline()
if !ok {
return fmt.Errorf("could not determine context deadline for create for %s", nestedItemId)
teowa marked this conversation as resolved.
Show resolved Hide resolved
teowa marked this conversation as resolved.
Show resolved Hide resolved
}

// from https://learn.microsoft.com/en-us/azure/azure-app-configuration/concept-enable-rbac#azure-built-in-roles-for-azure-app-configuration
// allow up to 15 min for role permission to be done propagated
// allow some time for role permission to be done propagated
metadata.Logger.Infof("[DEBUG] Waiting for App Configuration Key %q read permission to be done propagated", model.Key)
stateConf := &pluginsdk.StateChangeConf{
Pending: []string{"Forbidden"},
Target: []string{"Error", "Exists"},
Refresh: appConfigurationGetKeyRefreshFunc(ctx, client, model.Key, model.Label),
PollInterval: 20 * time.Second,
Timeout: 15 * time.Minute,
Timeout: time.Until(deadline),
}

if _, err = stateConf.WaitForStateContext(ctx); err != nil {
Expand Down