func (r *PostgreSqlReconciler) GenerateTFFromCR(instance *sqlv1alpha1.PostgreSql, dir string, value map[string][]byte) error {
	errMsg := fmt.Sprintf("failed to generate tf files  %v/%v", instance.Name, instance.Namespace)
	errB := terraform.GenerateBucketTF(instance, filepath.Join(dir, "bucket"))
	if errB != nil {
		r.Log.Error(errB, errMsg)
		return errB
	}
	errP := terraform.GenerateProviderAndBackendTF(instance, filepath.Join(dir, "instance"))
	if errP != nil {
		r.Log.Error(errP, errMsg)
		return errP
	}
	errI := terraform.GenerateTFInstance(instance, filepath.Join(dir, "instance"), value)
	if errI != nil {
		r.Log.Error(errI, errMsg)
		return errI
	}
	errO := terraform.GenerateTFOutput(filepath.Join(dir, "instance"))
	if errO != nil {
		r.Log.Error(errO, errMsg)
		return errO
	}
	return nil
}
//GenerateTFFromCR generate tf files from CR
GenerateTFFromCR generate tf files from CR
// GenerateTFFromCR generate tf files from CR
func (r *PostgreSqlReconciler) GenerateTFFromCR(instance *sqlv1alpha1.PostgreSql, dir string, value map[string][]byte) error {
	errMsg := fmt.Sprintf("failed to generate tf files  %v/%v", instance.Name, instance.Namespace)
	errB := terraform.GenerateBucketTF(instance, filepath.Join(dir, "bucket"))
	if errB != nil {
		r.Log.Error(errB, errMsg)
		return errB
	}
	errP := terraform.GenerateProviderAndBackendTF(instance, filepath.Join(dir, "instance"))
	if errP != nil {
		r.Log.Error(errP, errMsg)
		return errP
	}
	errI := terraform.GenerateTFInstance(instance, filepath.Join(dir, "instance"), value)
	if errI != nil {
		r.Log.Error(errI, errMsg)
		return errI
	}
	errO := terraform.GenerateTFOutput(filepath.Join(dir, "instance"))
	if errO != nil {
		r.Log.Error(errO, errMsg)
		return errO
	}
	return nil
}
func ( r * PostgreSqlReconciler ) GenerateTFFromCR ( instance * sqlv1alpha1 . PostgreSql , dir string , value map [ string ] [ ] byte ) error { errMsg := fmt . Sprintf ( " " , instance . Name , instance . Namespace ) errB := terraform . GenerateBucketTF ( instance , filepath . Join ( dir , " " ) ) if errB != nil { r . Log . Error ( errB , errMsg ) return errB } errP := terraform . GenerateProviderAndBackendTF ( instance , filepath . Join ( dir , " " ) ) if errP != nil { r . Log . Error ( errP , errMsg ) return errP } errI := terraform . GenerateTFInstance ( instance , filepath . Join ( dir , " " ) , value ) if errI != nil { r . Log . Error ( errI , errMsg ) return errI } errO := terraform . GenerateTFOutput ( filepath . Join ( dir , " " ) ) if errO != nil { r . Log . Error ( errO , errMsg ) return errO } return nil }
GenerateTFFromCR generate tf files from CR
GenerateTFFromCR generate tf files from CR