diff --git a/references/cli/def.go b/references/cli/def.go index 14e1b56c2..e01d9eb12 100644 --- a/references/cli/def.go +++ b/references/cli/def.go @@ -295,7 +295,7 @@ func generateTerraformTypedComponentDefinition(cmd *cobra.Command, name, kind, p } switch provider { - case "aws", "azure", "alibaba", "tencent", "gcp", "baidu", "elastic": + case "aws", "azure", "alibaba", "tencent", "gcp", "baidu", "elastic", "ucloud": var terraform *commontype.Terraform git, err := cmd.Flags().GetString(FlagGit) @@ -371,7 +371,7 @@ func generateTerraformTypedComponentDefinition(cmd *cobra.Command, name, kind, p } return out.String(), nil default: - return "", errors.Errorf("Provider `%s` is not supported. Only `alibaba`, `aws`, `azure` are supported.", provider) + return "", errors.Errorf("Provider `%s` is not supported. Only `alibaba`, `aws`, `azure`, `gcp`, `baidu`, `tencent`, `elastic`, `ucloud` are supported.", provider) } } diff --git a/references/cli/provider.go b/references/cli/provider.go index 2007fce84..ba51938f4 100644 --- a/references/cli/provider.go +++ b/references/cli/provider.go @@ -188,7 +188,7 @@ func prepareProviderAddSubCommand(c common.Args) ([]*cobra.Command, error) { if err != nil { return err } - if value == "" { + if value == "" && p.Required { return fmt.Errorf("must specify a value for %s", p.Name) } properties[p.Name] = value @@ -219,9 +219,12 @@ func prepareProviderAddSubCommand(c common.Args) ([]*cobra.Command, error) { }, } if err := k8sClient.Create(ctx, a); err != nil { - return err + return fmt.Errorf("failed to authentiate Terraform cloud provier %s", providerType) } + fmt.Printf("Successfully authentiate provider %s for %s\n", name, providerType) + return nil } + return fmt.Errorf("failed to authentiate Terraform cloud provier %s", providerType) } return fmt.Errorf("terraform provider %s for %s already exists", name, providerType) }