Skip to content

Commit 946b444

Browse files
authored
feat(region-info): Model region-specific information (#1839)
Information such as: - is the AWS::CDK::Metadata resource supported in region? - what is the S3 static website endpoint? - how are service principals named? Fixes #1282
1 parent 5d40377 commit 946b444

File tree

122 files changed

+7546
-5996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+7546
-5996
lines changed

package-lock.json

+695-961
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"lerna": "^3.13.1",
1414
"nodeunit": "^0.11.2",
1515
"nyc": "^13.3.0",
16-
"tslint": "^5.13.0",
17-
"@types/jest": "^24.0.6",
18-
"jest": "^24.1.0",
16+
"tslint": "^5.13.1",
17+
"@types/jest": "^24.0.11",
18+
"jest": "^24.4.0",
1919
"ts-jest": "^24.0.0",
2020
"typescript": "^3.3.3333"
2121
},

packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json

+30-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
"Action": "sts:AssumeRole",
1313
"Effect": "Allow",
1414
"Principal": {
15-
"Service": "codepipeline.amazonaws.com"
15+
"Service": {
16+
"Fn::Join": [
17+
"",
18+
[
19+
"codepipeline.",
20+
{
21+
"Ref": "AWS::URLSuffix"
22+
}
23+
]
24+
]
25+
}
1626
}
1727
}
1828
],
@@ -145,12 +155,6 @@
145155
"CodePipelineB74E5936": {
146156
"Type": "AWS::CodePipeline::Pipeline",
147157
"Properties": {
148-
"ArtifactStore": {
149-
"Location": {
150-
"Ref": "ArtifactBucket7410C9EF"
151-
},
152-
"Type": "S3"
153-
},
154158
"RoleArn": {
155159
"Fn::GetAtt": [
156160
"CodePipelineRoleB3A660B4",
@@ -236,7 +240,13 @@
236240
],
237241
"Name": "Deploy"
238242
}
239-
]
243+
],
244+
"ArtifactStore": {
245+
"Location": {
246+
"Ref": "ArtifactBucket7410C9EF"
247+
},
248+
"Type": "S3"
249+
}
240250
},
241251
"DependsOn": [
242252
"CodePipelineRoleDefaultPolicy8D520A8D",
@@ -252,7 +262,17 @@
252262
"Action": "sts:AssumeRole",
253263
"Effect": "Allow",
254264
"Principal": {
255-
"Service": "cloudformation.amazonaws.com"
265+
"Service": {
266+
"Fn::Join": [
267+
"",
268+
[
269+
"cloudformation.",
270+
{
271+
"Ref": "AWS::URLSuffix"
272+
}
273+
]
274+
]
275+
}
256276
}
257277
}
258278
],
@@ -261,4 +281,4 @@
261281
}
262282
}
263283
}
264-
}
284+
}

packages/@aws-cdk/assets-docker/test/test.image-asset.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export = {
104104
// WHEN
105105
asset.repository.addToResourcePolicy(new iam.PolicyStatement()
106106
.addAction('BOOM')
107-
.addPrincipal(new iam.ServicePrincipal('DAMN')));
107+
.addPrincipal(new iam.ServicePrincipal('test.service')));
108108

109109
// THEN
110110
expect(stack).to(haveResource('Custom::ECRAdoptedRepository', {
@@ -117,7 +117,7 @@ export = {
117117
"Action": "BOOM",
118118
"Effect": "Allow",
119119
"Principal": {
120-
"Service": "DAMN"
120+
"Service": "test.service"
121121
}
122122
}
123123
],

packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.expected.json

+45-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@
99
"Action": "sts:AssumeRole",
1010
"Effect": "Allow",
1111
"Principal": {
12-
"Service": "lambda.amazonaws.com"
12+
"Service": {
13+
"Fn::Join": [
14+
"",
15+
[
16+
"lambda.",
17+
{
18+
"Ref": "AWS::URLSuffix"
19+
}
20+
]
21+
]
22+
}
1323
}
1424
}
1525
],
@@ -203,7 +213,17 @@
203213
"Action": "sts:AssumeRole",
204214
"Effect": "Allow",
205215
"Principal": {
206-
"Service": "lambda.amazonaws.com"
216+
"Service": {
217+
"Fn::Join": [
218+
"",
219+
[
220+
"lambda.",
221+
{
222+
"Ref": "AWS::URLSuffix"
223+
}
224+
]
225+
]
226+
}
207227
}
208228
}
209229
],
@@ -397,7 +417,17 @@
397417
"Action": "sts:AssumeRole",
398418
"Effect": "Allow",
399419
"Principal": {
400-
"Service": "lambda.amazonaws.com"
420+
"Service": {
421+
"Fn::Join": [
422+
"",
423+
[
424+
"lambda.",
425+
{
426+
"Ref": "AWS::URLSuffix"
427+
}
428+
]
429+
]
430+
}
401431
}
402432
}
403433
],
@@ -555,7 +585,17 @@
555585
"Action": "sts:AssumeRole",
556586
"Effect": "Allow",
557587
"Principal": {
558-
"Service": "apigateway.amazonaws.com"
588+
"Service": {
589+
"Fn::Join": [
590+
"",
591+
[
592+
"apigateway.",
593+
{
594+
"Ref": "AWS::URLSuffix"
595+
}
596+
]
597+
]
598+
}
559599
}
560600
}
561601
],
@@ -850,4 +890,4 @@
850890
}
851891
}
852892
}
853-
}
893+
}

packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.expected.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@
3939
"Action": "sts:AssumeRole",
4040
"Effect": "Allow",
4141
"Principal": {
42-
"Service": "apigateway.amazonaws.com"
42+
"Service": {
43+
"Fn::Join": [
44+
"",
45+
[
46+
"apigateway.",
47+
{
48+
"Ref": "AWS::URLSuffix"
49+
}
50+
]
51+
]
52+
}
4353
}
4454
}
4555
],
@@ -123,4 +133,4 @@
123133
}
124134
}
125135
}
126-
}
136+
}

packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json

+23-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@
6565
"Action": "sts:AssumeRole",
6666
"Effect": "Allow",
6767
"Principal": {
68-
"Service": "apigateway.amazonaws.com"
68+
"Service": {
69+
"Fn::Join": [
70+
"",
71+
[
72+
"apigateway.",
73+
{
74+
"Ref": "AWS::URLSuffix"
75+
}
76+
]
77+
]
78+
}
6979
}
7080
}
7181
],
@@ -329,7 +339,17 @@
329339
"Action": "sts:AssumeRole",
330340
"Effect": "Allow",
331341
"Principal": {
332-
"Service": "lambda.amazonaws.com"
342+
"Service": {
343+
"Fn::Join": [
344+
"",
345+
[
346+
"lambda.",
347+
{
348+
"Ref": "AWS::URLSuffix"
349+
}
350+
]
351+
]
352+
}
333353
}
334354
}
335355
],
@@ -615,4 +635,4 @@
615635
}
616636
}
617637
}
618-
}
638+
}

packages/@aws-cdk/aws-apigateway/test/test.restapi.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export = {
6060
{
6161
Action: "sts:AssumeRole",
6262
Effect: "Allow",
63-
Principal: { Service: "apigateway.amazonaws.com" }
63+
Principal: { Service: { "Fn::Join": ["", ["apigateway.", { Ref: "AWS::URLSuffix" }]] } }
6464
}
6565
],
6666
Version: "2012-10-17"

packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.expected.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,17 @@
375375
"Action": "sts:AssumeRole",
376376
"Effect": "Allow",
377377
"Principal": {
378-
"Service": "ec2.amazonaws.com"
378+
"Service": {
379+
"Fn::Join": [
380+
"",
381+
[
382+
"ec2.",
383+
{
384+
"Ref": "AWS::URLSuffix"
385+
}
386+
]
387+
]
388+
}
379389
}
380390
}
381391
],

packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.expected.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,17 @@
549549
"Action": "sts:AssumeRole",
550550
"Effect": "Allow",
551551
"Principal": {
552-
"Service": "ec2.amazonaws.com"
552+
"Service": {
553+
"Fn::Join": [
554+
"",
555+
[
556+
"ec2.",
557+
{
558+
"Ref": "AWS::URLSuffix"
559+
}
560+
]
561+
]
562+
}
553563
}
554564
}
555565
],
@@ -716,4 +726,4 @@
716726
]
717727
}
718728
}
719-
}
729+
}

packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.expected.json

+16-6
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,17 @@
396396
"Action": "sts:AssumeRole",
397397
"Effect": "Allow",
398398
"Principal": {
399-
"Service": "ec2.amazonaws.com"
399+
"Service": {
400+
"Fn::Join": [
401+
"",
402+
[
403+
"ec2.",
404+
{
405+
"Ref": "AWS::URLSuffix"
406+
}
407+
]
408+
]
409+
}
400410
}
401411
}
402412
],
@@ -640,13 +650,13 @@
640650
"Properties": {
641651
"Port": 80,
642652
"Protocol": "HTTP",
643-
"VpcId": {
644-
"Ref": "VPCB9E5F0B4"
645-
},
646653
"TargetGroupAttributes": [],
647654
"Targets": [],
648-
"TargetType": "instance"
655+
"TargetType": "instance",
656+
"VpcId": {
657+
"Ref": "VPCB9E5F0B4"
658+
}
649659
}
650660
}
651661
}
652-
}
662+
}

packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.expected.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,17 @@
375375
"Action": "sts:AssumeRole",
376376
"Effect": "Allow",
377377
"Principal": {
378-
"Service": "ec2.amazonaws.com"
378+
"Service": {
379+
"Fn::Join": [
380+
"",
381+
[
382+
"ec2.",
383+
{
384+
"Ref": "AWS::URLSuffix"
385+
}
386+
]
387+
]
388+
}
379389
}
380390
}
381391
],

packages/@aws-cdk/aws-autoscaling/test/integ.external-role.expected.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,17 @@
505505
"Action": "sts:AssumeRole",
506506
"Effect": "Allow",
507507
"Principal": {
508-
"Service": "ec2.amazonaws.com"
508+
"Service": {
509+
"Fn::Join": [
510+
"",
511+
[
512+
"ec2.",
513+
{
514+
"Ref": "AWS::URLSuffix"
515+
}
516+
]
517+
]
518+
}
509519
}
510520
}
511521
],

packages/@aws-cdk/aws-autoscaling/test/test.lifecyclehooks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export = {
4646
{
4747
Action: "sts:AssumeRole",
4848
Effect: "Allow",
49-
Principal: { Service: "autoscaling.amazonaws.com" }
49+
Principal: { Service: { "Fn::Join": ["", ["autoscaling.", { Ref: "AWS::URLSuffix" }]] } }
5050
}
5151
],
5252
}

0 commit comments

Comments
 (0)