Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/pkg/cli/deploy/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ func (d *envDeployer) validateALBWorkloadsDontRedirect() error {
if err != nil {
return fmt.Errorf("get env params: %w", err)
}

if params[cfnstack.EnvParamALBWorkloadsKey] == "" {
return nil
}
services := strings.Split(params[cfnstack.EnvParamALBWorkloadsKey], ",")
g, ctx := errgroup.WithContext(context.Background())

Expand Down
11 changes: 11 additions & 0 deletions internal/pkg/cli/deploy/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,17 @@ func TestEnvDeployer_Validate(t *testing.T) {
},
expected: "enable TLS termination on CDN: get env params: some error",
},
"cdn tls termination enabled, skip if no services deployed": {
app: &config.Application{},
mft: mftCDNTerminateTLSAndHTTPCert,
setUpMocks: func(m *envDeployerMocks, ctrl *gomock.Controller) {
m.stackDescribers = map[string]*mocks.MockstackDescriber{
"svc1": mocks.NewMockstackDescriber(ctrl),
}

m.envDescriber.EXPECT().Params().Return(map[string]string{}, nil)
},
},
"cdn tls termination enabled, fail to get service resources": {
app: &config.Application{},
mft: mftCDNTerminateTLSAndHTTPCert,
Expand Down
6 changes: 0 additions & 6 deletions internal/pkg/manifest/validate_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,6 @@ func (i RestrictiveIngress) validate() error {
// validate returns nil if advancedCDNConfig is configured correctly.
func (cfg AdvancedCDNConfig) validate() error {
if cfg.Certificate == nil {
if aws.BoolValue(cfg.TerminateTLS) {
return &errFieldMustBeSpecified{
missingField: "certificate",
conditionalFields: []string{"terminate_tls"},
}
}
return nil
}
certARN, err := arn.Parse(*cfg.Certificate)
Expand Down
8 changes: 0 additions & 8 deletions internal/pkg/manifest/validate_env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,14 +777,6 @@ func TestCDNConfiguration_validate(t *testing.T) {
},
wantedError: errors.New("cdn certificate must be in region us-east-1"),
},
"error if terminate tls set without cert": {
in: EnvironmentCDNConfig{
Config: AdvancedCDNConfig{
TerminateTLS: aws.Bool(true),
},
},
wantedError: errors.New(`"certificate" must be specified if "terminate_tls" is specified`),
},
"success with cert and terminate tls": {
in: EnvironmentCDNConfig{
Config: AdvancedCDNConfig{
Expand Down