func (r *PostgreSqlReconciler) ProvisioningInstance(dir string, instance *sqlv1alpha1.PostgreSql, ctx context.Context) error {
	err := terraform.Apply(filepath.Join(dir, "instance"))
	if err != nil {
		errMsg := fmt.Sprintf("provisioning sql instance  %v/%v failed", instance.Name, instance.Namespace)
		r.Log.Error(err, errMsg)

		errUp := r.UpdateStatus(ctx, instance, sqlv1alpha1.PhaseFailed)
		r.Recorder.Eventf(instance, kubeApiV1.EventTypeWarning, "ApplyingFailed ", "failed to provision cloud sql instance %q", instance.Name)
		if errUp != nil {
			return errUp
		}
		return err
	}
	return nil
}
//ProvisioningInstance provision sql instance based on generated tf
ProvisioningInstance provision sql instance based on generated tf
// ProvisioningInstance provision sql instance based on generated tf
func (r *PostgreSqlReconciler) ProvisioningInstance(dir string, instance *sqlv1alpha1.PostgreSql, ctx context.Context) error {
	err := terraform.Apply(filepath.Join(dir, "instance"))
	if err != nil {
		errMsg := fmt.Sprintf("provisioning sql instance  %v/%v failed", instance.Name, instance.Namespace)
		r.Log.Error(err, errMsg)
		errUp := r.UpdateStatus(ctx, instance, sqlv1alpha1.PhaseFailed)
		r.Recorder.Eventf(instance, kubeApiV1.EventTypeWarning, "ApplyingFailed ", "failed to provision cloud sql instance %q", instance.Name)
		if errUp != nil {
			return errUp
		}
		return err
	}
	return nil
}
func ( r * PostgreSqlReconciler ) ProvisioningInstance ( dir string , instance * sqlv1alpha1 . PostgreSql , ctx context . Context ) error { err := terraform . Apply ( filepath . Join ( dir , " " ) ) if err != nil { errMsg := fmt . Sprintf ( " " , instance . Name , instance . Namespace ) r . Log . Error ( err , errMsg ) errUp := r . UpdateStatus ( ctx , instance , sqlv1alpha1 . PhaseFailed ) r . Recorder . Eventf ( instance , kubeApiV1 . EventTypeWarning , " " , " " , instance . Name ) if errUp != nil { return errUp } return err } return nil }
ProvisioningInstance provision sql instance based on generated tf
ProvisioningInstance provision sql instance based on generated tf