Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloudfront): make long function name deterministic #30392

Merged
merged 79 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
496e264
Fix cloudfront function name gen logic
May 30, 2024
30194d5
Merge branch 'main' into fix-cf-fn-name
Leo10Gama May 30, 2024
c0a1051
Update integ tests
May 30, 2024
085bc1d
Merge branch 'main' into fix-cf-fn-name
Leo10Gama May 30, 2024
8d16fb6
Fix formatting
May 30, 2024
22ad2eb
Merge branch 'fix-cf-fn-name' of https://github.com/Leo9Gama/aws-cdk …
May 30, 2024
40d3444
Simplify long-name logic
Jun 3, 2024
b5efa09
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 3, 2024
36322da
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 3, 2024
aa8cc03
Remove exclusivity logic
Jun 6, 2024
0518fb3
Merge branch 'fix-cf-fn-name' of https://github.com/Leo10Gama/aws-cdk…
Jun 6, 2024
ed15c36
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 6, 2024
c36cfda
Formatting
Jun 6, 2024
8c2e8cd
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 6, 2024
c2115bd
Update integ tests
Jun 6, 2024
bc479b4
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 6, 2024
7689682
Update repo
Jun 6, 2024
6982576
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 6, 2024
c702d21
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 10, 2024
a9bf9a9
Update logic
Jun 10, 2024
fceca36
Merge branch 'fix-cf-fn-name' of https://github.com/Leo10Gama/aws-cdk…
Jun 10, 2024
77c2250
Preserve parsing logic from original method
Jun 10, 2024
1abccf8
Update integ test
Jun 10, 2024
b86e648
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 10, 2024
2df367f
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 10, 2024
62873c1
Implement requested changes
Jun 11, 2024
36472c1
Merge branch 'fix-cf-fn-name' of https://github.com/Leo10Gama/aws-cdk…
Jun 11, 2024
34654eb
Untrack feature flag
Jun 11, 2024
978063e
Merge branch 'main' into fix-cf-fn-name
Leo10Gama Jun 11, 2024
853d862
Untrack feature flag
Jun 11, 2024
e4e4a46
feat(lambda): allow running a build file (#30196)
bergjaak May 30, 2024
de8374f
docs(s3-deployment): update development section of readme (#30253)
neo01124 May 31, 2024
9b9bd59
fix(eks): add tag update support for eks cluster (#30123)
mrlikl May 31, 2024
608dff7
chore(release): 2.144.0
May 31, 2024
0ed761c
chore: remove revert from changelog
TheRealAmazonKendra May 31, 2024
bf3ee65
chore: update Contributors File (#30411)
aws-cdk-automation Jun 1, 2024
64dc89a
fix(apigateway): allow overriding authorizer on methods (#30415)
moelasmar Jun 1, 2024
145acb9
chore(deps): bump tj-actions/changed-files from 44.5.1 to 44.5.2 (#30…
dependabot[bot] Jun 3, 2024
4860303
chore: fix typo in `queue.ts` comment (#30416)
rafrafek Jun 3, 2024
7e0b198
chore: fix typo in application-listener-rule (#30427)
mazyu36 Jun 3, 2024
325f528
chore(config): add new resource types since March 2023 (#30378)
mazyu36 Jun 3, 2024
995d239
feat(logs): add distribution property to the Subscription class (#30423)
mazyu36 Jun 3, 2024
f60e209
Remove exclusivity logic
Jun 6, 2024
96fdad8
feat(chatbot): configure `userRoleRequired` for the `SlackChannelConf…
badmintoncryer Jun 3, 2024
41cef80
feat(codepipeline): `GitPushFilter` with branches and file paths for …
go-to-k Jun 3, 2024
ca97889
fix: route53 CrossAccountZoneDelegationRecord fails at deployment tim…
samson-keung Jun 4, 2024
d2d7990
chore: update nodejs to 20 in devcontainer and gitpod (#30424)
JohannesKonings Jun 4, 2024
b8b5e9d
feat(codebuild): `Fleet` L2 (#29754)
nmussy Jun 4, 2024
f8aeea7
chore(dynamodb): remove single quotes from throw statement in the par…
mazyu36 Jun 4, 2024
fa55230
chore(cdk): update the fact tables and tests for lambda layers v0.98.…
vasireddy99 Jun 5, 2024
411e78b
feat: update L1 CloudFormation resource definitions (#30438)
aws-cdk-automation Jun 5, 2024
013cf02
chore(roadmap): update to readme to point to correct location of road…
adamjkeller Jun 5, 2024
0b91e02
fix(custom-resources): `logApiResponseData` is added to custom resour…
colifran Jun 6, 2024
22e6fa4
revert: "feat(codepipeline): `GitPushFilter` with branches and file p…
gracelu0 Jun 6, 2024
3b193c1
feat(eks): support for Kubernetes version 1.30 (#30454)
pahud Jun 6, 2024
6e8d9ea
Formatting
Jun 6, 2024
656886c
chore(apigatewayv2): add apigatewayv2 integrations and authorizers to…
GavinZZ Jun 6, 2024
7f10d27
Update integ tests
Jun 6, 2024
405ff95
chore(events): rule cannot have more than 5 targets (#30470)
flexelem Jun 6, 2024
85a30e4
chore(lambda): match enum value to property (#30472)
scanlonp Jun 6, 2024
1ee9a97
feat(config): proactive evaluation mode (#30174)
badmintoncryer Jun 6, 2024
0b5f603
Update logic
Jun 10, 2024
862bf36
chore(stepfunction-tasks): eventbridge aws. event source prefix check…
pahud Jun 6, 2024
cf2550a
chore(release): 2.145.0
Jun 7, 2024
69a9343
chore: update CHANGELOG.v2.md
gracelu0 Jun 7, 2024
745f7b0
chore(rds): add support for 8.0.mysql_aurora.3.07.0 (#30479)
sakurai-ryo Jun 7, 2024
8d9a9c0
Preserve parsing logic from original method
Jun 10, 2024
509b897
Update integ test
Jun 10, 2024
76a5c3e
feat: update L1 CloudFormation resource definitions (#30508)
aws-cdk-automation Jun 10, 2024
21f7935
Implement requested changes
Jun 11, 2024
22acad3
feat(sns): add grantSubscribe method (#30486)
mazyu36 Jun 10, 2024
a6f0c7f
chore(rds): add support for postgres 15.6 aurora engine (#30167)
Chemsmith Jun 10, 2024
8bda505
Untrack feature flag
Jun 11, 2024
2d4e64e
feat(apprunner): add ipAddressType property to the Service class (#30…
mazyu36 Jun 11, 2024
1c0aa3e
Untrack feature flag
Jun 11, 2024
88b5243
Merge branch 'fix-cf-fn-name' of https://github.com/Leo10Gama/aws-cdk…
Jun 11, 2024
35acca0
Untrack feature flag
Jun 11, 2024
225d2c4
Update integ test
Jun 11, 2024
724640d
Merge branch 'main' into fix-cf-fn-name
mergify[bot] Jun 11, 2024
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
7 changes: 6 additions & 1 deletion packages/aws-cdk-lib/aws-cloudfront/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,12 @@ export class Function extends Resource implements IFunction {
private generateName(): string {
const name = Stack.of(this).region + Names.uniqueId(this);
if (name.length > 64) {
return name.substring(0, 32) + name.substring(name.length - 32);
if (name.startsWith('${Token[AWS.Region.') && name.indexOf('}') == 21) {
// Ensure consistency when region number is one digit or two
return name.substring(0, 31) + name.substring(name.length - 32);
} else {
return name.substring(0, 32) + name.substring(name.length - 32);
}
}
return name;
}
Expand Down
23 changes: 23 additions & 0 deletions packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,29 @@ describe('CloudFront Function', () => {
});
});

test('long name truncates correctly every time', () => {
const app = new App();
const stack = new Stack(app, 'CdkTestWithALongNameStack');

new Function(stack, 'MyCloudFrontFunction', {
code: FunctionCode.fromInline('')
});

Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', {
'Name': {
'Fn::Join': [
'',
[
{
'Ref': 'AWS::Region'
},
'CdkTestWitackMyCloudFrontFunction302260D0'
]
]
}
});
})

describe('key value store association', () => {
test('minimal example', () => {
const stack = new Stack();
Expand Down
Loading