NLB don't support securityGroups

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2020-10-06 10:55:45 +02:00
parent 60bd0e5303
commit 481e069b2e
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
1 changed files with 7 additions and 1 deletions

View File

@ -217,9 +217,15 @@ func (b *ecsAPIService) ensureLoadBalancer(r *awsResources, project *types.Proje
}
balancerType := getRequiredLoadBalancerType(project)
var securityGroups []string
if balancerType == elbv2.LoadBalancerTypeEnumApplication {
// see https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-register-targets.html#target-security-groups
// Network Load Balancers do not have associated security groups
securityGroups = r.getLoadBalancerSecurityGroups(project)
}
template.Resources["LoadBalancer"] = &elasticloadbalancingv2.LoadBalancer{
Scheme: elbv2.LoadBalancerSchemeEnumInternetFacing,
SecurityGroups: r.getLoadBalancerSecurityGroups(project),
SecurityGroups: securityGroups,
Subnets: r.subnets,
Tags: projectTags(project),
Type: balancerType,