Skip to content

Commit f4b0897

Browse files
authored
chore(release): v2.147.2 (#30698)
See CHANGELOG
2 parents d3695d4 + 680cc43 commit f4b0897

File tree

5 files changed

+20
-102
lines changed

5 files changed

+20
-102
lines changed

CHANGELOG.v2.alpha.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.147.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.147.1-alpha.0...v2.147.2-alpha.0) (2024-06-27)
6+
57
## [2.147.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.147.0-alpha.0...v2.147.1-alpha.0) (2024-06-21)
68

79
## [2.147.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.146.0-alpha.0...v2.147.0-alpha.0) (2024-06-20)

CHANGELOG.v2.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.147.2](https://github.com/aws/aws-cdk/compare/v2.147.1...v2.147.2) (2024-06-27)
6+
7+
8+
### Reverts
9+
10+
* fix(core): overrideLogicalId validation ([#29708](https://github.com/aws/aws-cdk/pull/29708)) ([b196b13](https://github.com/aws/aws-cdk/commit/b196b13b0b8a54dcacadf87fdbe744772a6e6c4d))
11+
512
## [2.147.1](https://github.com/aws/aws-cdk/compare/v2.147.0...v2.147.1) (2024-06-21)
613

714

815
### Reverts
916

10-
* route53 CrossAccountZoneDelegationRecord fails at deployment time with imported `delegatedZone` ([#30440](https://github.com/aws/aws-cdk/issues/30440))" ([#30606](https://github.com/aws/aws-cdk/issues/30606)) ([69eb617](https://github.com/aws/aws-cdk/commit/69eb617b45b5c4e495901d367d85e1edeea57e69)), closes [#30600](https://github.com/aws/aws-cdk/issues/30600)
17+
* route53 CrossAccountZoneDelegationRecord fails at deployment time with imported `delegatedZone` ([#30440](https://github.com/aws/aws-cdk/issues/30440)) ([a3d9b10](https://github.com/aws/aws-cdk/commit/a3d9b10ad9036486961f74e852493aa9684cfdb4))
1118

1219
## [2.147.0](https://github.com/aws/aws-cdk/compare/v2.146.0...v2.147.0) (2024-06-20)
1320

packages/aws-cdk-lib/core/lib/cfn-element.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,14 @@ export abstract class CfnElement extends Construct {
8181
/**
8282
* Overrides the auto-generated logical ID with a specific ID.
8383
* @param newLogicalId The new logical ID to use for this stack element.
84-
*
85-
* @throws an error if `logicalId` has already been locked
86-
* @throws an error if `newLogicalId` is empty
87-
* @throws an error if `newLogicalId` contains more than 255 characters
88-
* @throws an error if `newLogicalId` contains non-alphanumeric characters
89-
*
90-
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html#resources-section-structure-logicalid
9184
*/
9285
public overrideLogicalId(newLogicalId: string) {
9386
if (this._logicalIdLocked) {
9487
throw new Error(`The logicalId for resource at path ${Node.of(this).path} has been locked and cannot be overridden\n` +
9588
'Make sure you are calling "overrideLogicalId" before Stack.exportValue');
89+
} else {
90+
this._logicalIdOverride = newLogicalId;
9691
}
97-
98-
if (!Token.isUnresolved(newLogicalId)) {
99-
if (!newLogicalId) {
100-
throw new Error('Cannot set an empty logical ID');
101-
}
102-
if (newLogicalId.length > 255) {
103-
throw new Error(`Invalid logical ID override: '${newLogicalId}'. It must be at most 255 characters long, got ${newLogicalId.length} characters.`);
104-
}
105-
if (!newLogicalId.match(/^[A-Za-z0-9]+$/)) {
106-
throw new Error(`Invalid logical ID override: '${newLogicalId}'. It must only contain alphanumeric characters.`);
107-
}
108-
}
109-
110-
this._logicalIdOverride = newLogicalId;
11192
}
11293

11394
/**

packages/aws-cdk-lib/core/test/stack.test.ts

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,109 +1370,37 @@ describe('stack', () => {
13701370

13711371
// THEN - producers are the same
13721372
expect(() => {
1373-
resourceM.overrideLogicalId('OVERRIDELOGICALID');
1373+
resourceM.overrideLogicalId('OVERRIDE_LOGICAL_ID');
13741374
}).toThrow(/The logicalId for resource at path Producer\/ResourceXXX has been locked and cannot be overridden/);
13751375
});
13761376

1377-
test('throw error if overrideLogicalId contains non-alphanumeric characters', () => {
1378-
// GIVEN: manual
1379-
const appM = new App();
1380-
const producerM = new Stack(appM, 'Producer');
1381-
const resourceM = new CfnResource(producerM, 'ResourceXXX', { type: 'AWS::Resource' });
1382-
1383-
// THEN - producers are the same
1384-
expect(() => {
1385-
resourceM.overrideLogicalId('INVALID_LOGICAL_ID');
1386-
}).toThrow(/must only contain alphanumeric characters/);
1387-
});
1388-
1389-
test('throw error if overrideLogicalId is over 255 characters', () => {
1390-
// GIVEN: manual
1391-
const appM = new App();
1392-
const producerM = new Stack(appM, 'Producer');
1393-
const resourceM = new CfnResource(producerM, 'ResourceXXX', { type: 'AWS::Resource' });
1394-
1395-
// THEN - producers are the same
1396-
expect(() => {
1397-
resourceM.overrideLogicalId(
1398-
// 256 character long string of "aaaa..."
1399-
Array(256).fill('a').join(''),
1400-
);
1401-
}).toThrow(/must be at most 255 characters long, got 256 characters/);
1402-
});
1403-
1404-
test('throw error if overrideLogicalId is an empty string', () => {
1405-
// GIVEN: manual
1406-
const appM = new App();
1407-
const producerM = new Stack(appM, 'Producer');
1408-
const resourceM = new CfnResource(producerM, 'ResourceXXX', { type: 'AWS::Resource' });
1409-
1410-
// THEN - producers are the same
1411-
expect(() => {
1412-
resourceM.overrideLogicalId('');
1413-
}).toThrow('Cannot set an empty logical ID');
1414-
});
1415-
14161377
test('do not throw error if overrideLogicalId is used and logicalId is not locked', () => {
14171378
// GIVEN: manual
14181379
const appM = new App();
14191380
const producerM = new Stack(appM, 'Producer');
14201381
const resourceM = new CfnResource(producerM, 'ResourceXXX', { type: 'AWS::Resource' });
14211382

14221383
// THEN - producers are the same
1423-
resourceM.overrideLogicalId('OVERRIDELOGICALID');
1424-
producerM.exportValue(resourceM.getAtt('Att'));
1425-
1426-
const template = appM.synth().getStackByName(producerM.stackName).template;
1427-
expect(template).toMatchObject({
1428-
Outputs: {
1429-
ExportsOutputFnGetAttOVERRIDELOGICALIDAtt76AC816F: {
1430-
Export: {
1431-
Name: 'Producer:ExportsOutputFnGetAttOVERRIDELOGICALIDAtt76AC816F',
1432-
},
1433-
Value: {
1434-
'Fn::GetAtt': [
1435-
'OVERRIDELOGICALID',
1436-
'Att',
1437-
],
1438-
},
1439-
},
1440-
},
1441-
Resources: {
1442-
OVERRIDELOGICALID: {
1443-
Type: 'AWS::Resource',
1444-
},
1445-
},
1446-
});
1447-
});
1448-
1449-
test('do not throw if overrideLogicalId is unresolved', () => {
1450-
// GIVEN: manual
1451-
const appM = new App();
1452-
const producerM = new Stack(appM, 'Producer');
1453-
const resourceM = new CfnResource(producerM, 'ResourceXXX', { type: 'AWS::Resource' });
1454-
1455-
// THEN - producers are the same
1456-
resourceM.overrideLogicalId(Lazy.string({ produce: () => 'INVALID_LOGICAL_ID' }));
1384+
resourceM.overrideLogicalId('OVERRIDE_LOGICAL_ID');
14571385
producerM.exportValue(resourceM.getAtt('Att'));
14581386

14591387
const template = appM.synth().getStackByName(producerM.stackName).template;
14601388
expect(template).toMatchObject({
14611389
Outputs: {
1462-
ExportsOutputFnGetAttINVALIDLOGICALIDAtt6CB9E5B9: {
1390+
ExportsOutputFnGetAttOVERRIDELOGICALIDAtt2DD28019: {
14631391
Export: {
1464-
Name: 'Producer:ExportsOutputFnGetAttINVALIDLOGICALIDAtt6CB9E5B9',
1392+
Name: 'Producer:ExportsOutputFnGetAttOVERRIDELOGICALIDAtt2DD28019',
14651393
},
14661394
Value: {
14671395
'Fn::GetAtt': [
1468-
'INVALID_LOGICAL_ID',
1396+
'OVERRIDE_LOGICAL_ID',
14691397
'Att',
14701398
],
14711399
},
14721400
},
14731401
},
14741402
Resources: {
1475-
INVALID_LOGICAL_ID: {
1403+
OVERRIDE_LOGICAL_ID: {
14761404
Type: 'AWS::Resource',
14771405
},
14781406
},

version.v2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "2.147.1",
3-
"alphaVersion": "2.147.1-alpha.0"
2+
"version": "2.147.2",
3+
"alphaVersion": "2.147.2-alpha.0"
44
}

0 commit comments

Comments
 (0)