Add check to only provision SQL User once
@@ -138,17 +138,17 @@ func (m *AzureSqlUserManager) DropUser(ctx context.Context, db *sql.DB, user str
}
func (s *AzureSqlUserManager) Ensure(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error) {
+ instance, err := s.convert(obj)
+ if err != nil {
+ return false, err
+ }
+ if !instance.Status.Provisioned {
options := &resourcemanager.Options{}
for _, opt := range opts {
opt(options)
}
- instance, err := s.convert(obj)
- if err != nil {
- return false, err
- }
-
adminSecretClient := s.SecretClient
adminsecretName := instance.Spec.AdminSecret
@@ -391,6 +391,7 @@ func (s *AzureSqlUserManager) Ensure(ctx context.Context, obj runtime.Object, op
instance.Status.Provisioned = true
instance.Status.State = "Succeeded"
instance.Status.Message = resourcemanager.SuccessMsg
+ }
return true, nil
}
