Explorar o código

fix custom vpc setup

Signed-off-by: aiordache <[email protected]>
Signed-off-by: Nicolas De Loof <[email protected]>
aiordache %!s(int64=5) %!d(string=hai) anos
pai
achega
1cde947297
Modificáronse 3 ficheiros con 5 adicións e 5 borrados
  1. 1 1
      ecs/Dockerfile
  2. 4 0
      ecs/pkg/amazon/backend/up.go
  3. 0 4
      ecs/pkg/amazon/sdk/sdk.go

+ 1 - 1
ecs/Dockerfile

@@ -1,6 +1,6 @@
 # syntax = docker/dockerfile:experimental
 ARG GO_VERSION=1.14.4-alpine
-ARG ALPINE_PKG_DOCKER_VERSION=19.03.11-r0
+ARG ALPINE_PKG_DOCKER_VERSION=19.03.12-r0
 ARG GOLANGCI_LINT_VERSION=v1.27.0-alpine
 
 FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base

+ 4 - 0
ecs/pkg/amazon/backend/up.go

@@ -40,6 +40,9 @@ func (b *Backend) Up(ctx context.Context, options cli.ProjectOptions) error {
 	if err != nil {
 		return err
 	}
+	if len(subNets) < 2 {
+		return fmt.Errorf("VPC %s should have at least 2 associated subnets in different availability zones", vpc)
+	}
 
 	lb, err := b.GetLoadBalancer(ctx, project)
 	if err != nil {
@@ -95,6 +98,7 @@ func (b Backend) GetVPC(ctx context.Context, project *types.Project) (string, er
 		if !ok {
 			return "", fmt.Errorf("VPC does not exist: %s", vpc)
 		}
+		return vpcID, nil
 	}
 	defaultVPC, err := b.api.GetDefaultVPC(ctx)
 	if err != nil {

+ 0 - 4
ecs/pkg/amazon/sdk/sdk.go

@@ -125,10 +125,6 @@ func (s sdk) GetSubNets(ctx context.Context, vpcID string) ([]string, error) {
 				Name:   aws.String("vpc-id"),
 				Values: []*string{aws.String(vpcID)},
 			},
-			{
-				Name:   aws.String("default-for-az"),
-				Values: []*string{aws.String("true")},
-			},
 		},
 	})
 	if err != nil {