Skip to content

Commit 01b94f8

Browse files
authored
fix(elasticloadbalancingv2): upgrade to v1.92.0 drops certificates on ALB if more than 2 certificates exist (#13490)
Support for multiple certificates attached to a single ALB listener was originally implemented by putting all certificates in an array on a single `ListenerCertificate` resource. The docs state that only one certificate may be specified, although multiple certificates do appear to work initially. Initial resource creation of a `ListenerCertificate` with multiple certificates appears to succeed, but subsequent updates to this resource (to either add or remove certificates) yields undefined and undesireable behavior. The fix in #13332 attempted to fix this by creating a new `ListenerCertificate` per certificate, and -- at my direction -- maintained partial backwards compatibility by keeping the original ID for the first `ListenerCertificate` resource. However, this has the effect of triggering an update to the existing resource, which does not appear to work correctly. By forcing a logical ID change for all `ListenerCertificate` resources, we can force all existing resources to be deleted, and new resources created. This avoids doing any updates on any `ListenerCertificate` resources with an array of certificates, which appears to side-step the undefined behavior. fixes #13437 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b1449a1 commit 01b94f8

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ export class ApplicationListener extends BaseListener implements IApplicationLis
266266
// Only one certificate can be specified per resource, even though
267267
// `certificates` is of type Array
268268
for (let i = 0; i < additionalCerts.length; i++) {
269-
// ids should look like: `id`, `id2`, `id3` (for backwards-compatibility)
270-
const certId = (i > 0) ? `${id}${i + 1}` : id;
271-
new ApplicationListenerCertificate(this, certId, {
269+
new ApplicationListenerCertificate(this, `${id}${i + 1}`, {
272270
listener: this,
273271
certificates: [additionalCerts[i]],
274272
});

packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/listener.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ describe('tests', () => {
162162
],
163163
});
164164

165-
expect(listener.node.tryFindChild('DefaultCertificates')).toBeDefined();
165+
expect(listener.node.tryFindChild('DefaultCertificates1')).toBeDefined();
166166
expect(listener.node.tryFindChild('DefaultCertificates2')).toBeDefined();
167167
expect(listener.node.tryFindChild('DefaultCertificates3')).not.toBeDefined();
168168

0 commit comments

Comments
 (0)