diff --git a/internal/services/appconfiguration/app_configuration_feature_resource.go b/internal/services/appconfiguration/app_configuration_feature_resource.go index 3766186be068..f5e257cfc123 100644 --- a/internal/services/appconfiguration/app_configuration_feature_resource.go +++ b/internal/services/appconfiguration/app_configuration_feature_resource.go @@ -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("internal-error: context had no deadline") + } + // 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 { diff --git a/internal/services/appconfiguration/app_configuration_key_resource.go b/internal/services/appconfiguration/app_configuration_key_resource.go index 5951008da086..9d71022460db 100644 --- a/internal/services/appconfiguration/app_configuration_key_resource.go +++ b/internal/services/appconfiguration/app_configuration_key_resource.go @@ -144,15 +144,20 @@ func (k KeyResource) Create() sdk.ResourceFunc { return err } + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") + } + // 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 {