fix custom vpc setup

Signed-off-by: aiordache <anca.iordache@docker.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
aiordache 2020-07-24 17:24:26 +02:00 committed by Nicolas De Loof
parent 716fd13690
commit 1cde947297
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
3 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# syntax = docker/dockerfile:experimental # syntax = docker/dockerfile:experimental
ARG GO_VERSION=1.14.4-alpine 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 ARG GOLANGCI_LINT_VERSION=v1.27.0-alpine
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base

View File

@ -40,6 +40,9 @@ func (b *Backend) Up(ctx context.Context, options cli.ProjectOptions) error {
if err != nil { if err != nil {
return err 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) lb, err := b.GetLoadBalancer(ctx, project)
if err != nil { if err != nil {
@ -95,6 +98,7 @@ func (b Backend) GetVPC(ctx context.Context, project *types.Project) (string, er
if !ok { if !ok {
return "", fmt.Errorf("VPC does not exist: %s", vpc) return "", fmt.Errorf("VPC does not exist: %s", vpc)
} }
return vpcID, nil
} }
defaultVPC, err := b.api.GetDefaultVPC(ctx) defaultVPC, err := b.api.GetDefaultVPC(ctx)
if err != nil { if err != nil {

View File

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