diff --git a/cmd/cloud/deployment.go b/cmd/cloud/deployment.go index 32dc28bd4..093b7d7f3 100644 --- a/cmd/cloud/deployment.go +++ b/cmd/cloud/deployment.go @@ -76,7 +76,7 @@ var ( httpClient = httputil.NewHTTPClient() errFlag = errors.New("--deployment-file can not be used with other arguments") errInvalidExecutor = errors.New("not a valid executor") - errInvalidCloudProvider = errors.New("not a valid cloud provider. It can only be gcp") + errInvalidCloudProvider = errors.New("not a valid cloud provider. It can only be gcp or aws") ) func newDeploymentRootCmd(out io.Writer) *cobra.Command { @@ -155,7 +155,7 @@ func newDeploymentCreateCmd(out io.Writer) *cobra.Command { cmd.Flags().BoolVarP(&deploymentCreateEnforceCD, "enforce-cicd", "", false, "Provide this flag means deploys to deployment must use an API Key or Token. This essentially forces Deploys to happen through CI/CD") if organization.IsOrgHosted() { cmd.Flags().StringVarP(&clusterType, "cluster-type", "", standard, "The Cluster Type to use for the Deployment. Possible values can be standard or dedicated.") - cmd.Flags().StringVarP(&cloudProvider, "cloud-provider", "p", "gcp", "The Cloud Provider to use for the Deployment. Possible values can be gcp.") + cmd.Flags().StringVarP(&cloudProvider, "cloud-provider", "p", "gcp", "The Cloud Provider to use for the Deployment. Possible values can be gcp, aws.") cmd.Flags().StringVarP(®ion, "region", "", "", "The Cloud Provider region to use for the Deployment.") cmd.Flags().StringVarP(&schedulerSize, "scheduler-size", "", "", "The size of scheduler for the Deployment. Possible values can be small, medium, large") cmd.Flags().StringVarP(&highAvailability, "high-availability", "a", "disable", "Enables High Availability for the Deployment") @@ -380,7 +380,6 @@ func deploymentCreate(cmd *cobra.Command, _ []string, out io.Writer) error { return fmt.Errorf("%s is %w", cloudProvider, errInvalidCloudProvider) } } - // Silence Usage as we have now validated command input cmd.SilenceUsage = true @@ -496,5 +495,5 @@ func isValidExecutor(executor string) bool { // isValidCloudProvider returns true for valid CloudProvider values and false if not. func isValidCloudProvider(cloudProvider astrocore.SharedClusterCloudProvider) bool { - return cloudProvider == astrocore.SharedClusterCloudProviderGcp + return cloudProvider == astrocore.SharedClusterCloudProviderGcp || cloudProvider == astrocore.SharedClusterCloudProviderAws } diff --git a/cmd/cloud/deployment_test.go b/cmd/cloud/deployment_test.go index e8cad21a5..805fff032 100644 --- a/cmd/cloud/deployment_test.go +++ b/cmd/cloud/deployment_test.go @@ -865,11 +865,15 @@ func TestIsValidExecutor(t *testing.T) { } func TestIsValidCloudProvider(t *testing.T) { - t.Run("returns true if cloudProvider is GCP", func(t *testing.T) { + t.Run("returns true if cloudProvider is gcp", func(t *testing.T) { actual := isValidCloudProvider("gcp") assert.True(t, actual) }) - t.Run("returns false if cloudProvider is not GCP", func(t *testing.T) { + t.Run("returns true if cloudProvider is aws", func(t *testing.T) { + actual := isValidCloudProvider("aws") + assert.True(t, actual) + }) + t.Run("returns false if cloudProvider is not gcp", func(t *testing.T) { actual := isValidCloudProvider("azure") assert.False(t, actual) })