Skip to content

Commit

Permalink
Fixed CF handling of LBv2 Certifictes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gitwater committed Apr 2, 2021
1 parent 25c870c commit 71cc056
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/paco/cftemplates/lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def init_lb(self, aws_name, template_title):

# Listener - SSL Certificates
ssl_cert_param_obj_list = []
unique_listener_cert_name = ""
if len(listener.ssl_certificates) > 0 and self.lb_config.is_enabled():
if listener.ssl_policy != '':
cfn_export_dict['SslPolicy'] = listener.ssl_policy
Expand All @@ -268,6 +269,7 @@ def init_lb(self, aws_name, template_title):
'CertificateArn': troposphere.Ref(ssl_cert_param)
} ]
else:
unique_listener_cert_name = f'{unique_listener_cert_name}{listener.ssl_certificates[ssl_cert_idx]}'
ssl_cert_param_obj_list.append(
troposphere.elasticloadbalancingv2.Certificate(
CertificateArn=troposphere.Ref(ssl_cert_param)
Expand All @@ -282,8 +284,9 @@ def init_lb(self, aws_name, template_title):

# ListenerCertificates
if len(ssl_cert_param_obj_list) > 0:
logical_listener_cert_name = self.create_cfn_logical_id_join([logical_listener_name, 'Certificate', unique_listener_cert_name])
troposphere.elasticloadbalancingv2.ListenerCertificate(
title=logical_listener_name+'Certificate',
title=logical_listener_cert_name,
template=self.template,
Certificates=ssl_cert_param_obj_list,
ListenerArn=troposphere.Ref(listener_resource)
Expand Down

0 comments on commit 71cc056

Please sign in to comment.