mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
cli: remove debug env check for AWS (#460)
This commit is contained in:
parent
cf36b85ff9
commit
309a4b5196
@ -48,10 +48,6 @@ func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, c
|
||||
) (clusterid.File, error) {
|
||||
switch provider {
|
||||
case cloudprovider.AWS:
|
||||
// TODO: Remove this once AWS is supported.
|
||||
if os.Getenv("CONSTELLATION_AWS_DEV") != "1" {
|
||||
return clusterid.File{}, fmt.Errorf("AWS isn't supported yet")
|
||||
}
|
||||
cl, err := c.newTerraformClient(ctx)
|
||||
if err != nil {
|
||||
return clusterid.File{}, err
|
||||
|
@ -26,7 +26,6 @@ func newConfigGenerateCmd() *cobra.Command {
|
||||
Args: cobra.MatchAll(
|
||||
cobra.ExactArgs(1),
|
||||
isCloudProvider(0),
|
||||
warnAWS(0),
|
||||
),
|
||||
ValidArgsFunction: generateCompletion,
|
||||
RunE: runConfigGenerate,
|
||||
|
@ -8,7 +8,6 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/config/instancetypes"
|
||||
@ -27,26 +26,7 @@ func newConfigInstanceTypesCmd() *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
// TODO: Merge everything back into one function once AWS is supported.
|
||||
func printSupportedInstanceTypes(cmd *cobra.Command, args []string) {
|
||||
if os.Getenv("CONSTELLATION_AWS_DEV") == "1" {
|
||||
printSupportedInstanceTypesWithAWS()
|
||||
return
|
||||
}
|
||||
printSupportedInstanceTypesWithoutAWS()
|
||||
}
|
||||
|
||||
func printSupportedInstanceTypesWithoutAWS() {
|
||||
fmt.Printf(`Azure Confidential VM instance types:
|
||||
%v
|
||||
Azure Trusted Launch instance types:
|
||||
%v
|
||||
GCP instance types:
|
||||
%v
|
||||
`, formatInstanceTypes(instancetypes.AzureCVMInstanceTypes), formatInstanceTypes(instancetypes.AzureTrustedLaunchInstanceTypes), formatInstanceTypes(instancetypes.GCPInstanceTypes))
|
||||
}
|
||||
|
||||
func printSupportedInstanceTypesWithAWS() {
|
||||
fmt.Printf(`AWS instance families:
|
||||
%v
|
||||
Azure Confidential VM instance types:
|
||||
|
@ -7,24 +7,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// warnAWS warns that AWS isn't supported.
|
||||
func warnAWS(providerPos int) cobra.PositionalArgs {
|
||||
return func(cmd *cobra.Command, args []string) error {
|
||||
if cloudprovider.FromString(args[providerPos]) == cloudprovider.AWS && os.Getenv("CONSTELLATION_AWS_DEV") != "1" {
|
||||
return errors.New("AWS isn't supported yet")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func isCloudProvider(arg int) cobra.PositionalArgs {
|
||||
return func(cmd *cobra.Command, args []string) error {
|
||||
if provider := cloudprovider.FromString(args[arg]); provider == cloudprovider.Unknown {
|
||||
|
Loading…
Reference in New Issue
Block a user