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
1 change: 1 addition & 0 deletions internal/pkg/deploy/cloudformation/stack/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ func (e *EnvStackConfig) vpcConfig() (template.VPCConfig, error) {
Managed: e.managedVPC(),
AllowVPCIngress: aws.BoolValue(e.in.Mft.HTTPConfig.Private.SecurityGroupsConfig.Ingress.VPCIngress),
SecurityGroupConfig: securityGroupConfig,
FlowLogs: aws.BoolValue(e.in.Mft.Network.VPC.Flowlogs),
}, nil
}

Expand Down
69 changes: 69 additions & 0 deletions internal/pkg/deploy/cloudformation/stack/env_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,75 @@ type: Environment`
}(),
wantedFileName: "template-with-basic-manifest.yml",
},
"generate template with default vpc and flowlogs is on": {
input: func() *deploy.CreateEnvironmentInput {
rawMft := `name: test
type: Environment
network:
vpc:
flow_logs: on`
var mft manifest.Environment
err := yaml.Unmarshal([]byte(rawMft), &mft)
require.NoError(t, err)
return &deploy.CreateEnvironmentInput{
Version: "1.x",
App: deploy.AppInformation{
AccountPrincipalARN: "arn:aws:iam::000000000:root",
Name: "demo",
},
Name: "test",
ArtifactBucketARN: "arn:aws:s3:::mockbucket",
ArtifactBucketKeyARN: "arn:aws:kms:us-west-2:000000000:key/1234abcd-12ab-34cd-56ef-1234567890ab",
CustomResourcesURLs: map[string]string{
"CertificateValidationFunction": "https://mockbucket.s3-us-west-2.amazonaws.com/dns-cert-validator",
"DNSDelegationFunction": "https://mockbucket.s3-us-west-2.amazonaws.com/dns-delegation",
"CustomDomainFunction": "https://mockbucket.s3-us-west-2.amazonaws.com/custom-domain",
},
Mft: &mft,
RawMft: []byte(rawMft),
}
}(),
wantedFileName: "template-with-defaultvpc-flowlogs.yml",
},

"generate template with imported vpc and flowlogs is on": {
input: func() *deploy.CreateEnvironmentInput {
rawMft := `name: test
type: Environment
network:
vpc:
id: 'vpc-12345'
subnets:
public:
- id: 'subnet-11111'
- id: 'subnet-22222'
private:
- id: 'subnet-33333'
- id: 'subnet-44444'
flow_logs: on`
var mft manifest.Environment
err := yaml.Unmarshal([]byte(rawMft), &mft)
require.NoError(t, err)
return &deploy.CreateEnvironmentInput{
Version: "1.x",
App: deploy.AppInformation{
AccountPrincipalARN: "arn:aws:iam::000000000:root",
Name: "demo",
},
Name: "test",
ArtifactBucketARN: "arn:aws:s3:::mockbucket",
ArtifactBucketKeyARN: "arn:aws:kms:us-west-2:000000000:key/1234abcd-12ab-34cd-56ef-1234567890ab",
CustomResourcesURLs: map[string]string{
"CertificateValidationFunction": "https://mockbucket.s3-us-west-2.amazonaws.com/dns-cert-validator",
"DNSDelegationFunction": "https://mockbucket.s3-us-west-2.amazonaws.com/dns-delegation",
"CustomDomainFunction": "https://mockbucket.s3-us-west-2.amazonaws.com/custom-domain",
},
Mft: &mft,
RawMft: []byte(rawMft),
}
}(),
wantedFileName: "template-with-importedvpc-flowlogs.yml",
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
Expand Down
Loading