Skip to content

Commit

Permalink
feat(region-info): Model region-specific information (#1839)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
RomainMuller authored Mar 13, 2019
1 parent 5d40377 commit 946b444
Show file tree
Hide file tree
Showing 122 changed files with 7,546 additions and 5,996 deletions.
1,656 changes: 695 additions & 961 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"lerna": "^3.13.1",
"nodeunit": "^0.11.2",
"nyc": "^13.3.0",
"tslint": "^5.13.0",
"@types/jest": "^24.0.6",
"jest": "^24.1.0",
"tslint": "^5.13.1",
"@types/jest": "^24.0.11",
"jest": "^24.4.0",
"ts-jest": "^24.0.0",
"typescript": "^3.3.3333"
},
Expand Down
40 changes: 30 additions & 10 deletions packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "codepipeline.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"codepipeline.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -145,12 +155,6 @@
"CodePipelineB74E5936": {
"Type": "AWS::CodePipeline::Pipeline",
"Properties": {
"ArtifactStore": {
"Location": {
"Ref": "ArtifactBucket7410C9EF"
},
"Type": "S3"
},
"RoleArn": {
"Fn::GetAtt": [
"CodePipelineRoleB3A660B4",
Expand Down Expand Up @@ -236,7 +240,13 @@
],
"Name": "Deploy"
}
]
],
"ArtifactStore": {
"Location": {
"Ref": "ArtifactBucket7410C9EF"
},
"Type": "S3"
}
},
"DependsOn": [
"CodePipelineRoleDefaultPolicy8D520A8D",
Expand All @@ -252,7 +262,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "cloudformation.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"cloudformation.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand All @@ -261,4 +281,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assets-docker/test/test.image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export = {
// WHEN
asset.repository.addToResourcePolicy(new iam.PolicyStatement()
.addAction('BOOM')
.addPrincipal(new iam.ServicePrincipal('DAMN')));
.addPrincipal(new iam.ServicePrincipal('test.service')));

// THEN
expect(stack).to(haveResource('Custom::ECRAdoptedRepository', {
Expand All @@ -117,7 +117,7 @@ export = {
"Action": "BOOM",
"Effect": "Allow",
"Principal": {
"Service": "DAMN"
"Service": "test.service"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"lambda.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -203,7 +213,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"lambda.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -397,7 +417,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"lambda.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -555,7 +585,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"apigateway.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -850,4 +890,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"apigateway.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -123,4 +133,4 @@
}
}
}
}
}
26 changes: 23 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"apigateway.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -329,7 +339,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"lambda.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -615,4 +635,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/test.restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export = {
{
Action: "sts:AssumeRole",
Effect: "Allow",
Principal: { Service: "apigateway.amazonaws.com" }
Principal: { Service: { "Fn::Join": ["", ["apigateway.", { Ref: "AWS::URLSuffix" }]] } }
}
],
Version: "2012-10-17"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"ec2.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"ec2.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -716,4 +726,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"ec2.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down Expand Up @@ -640,13 +650,13 @@
"Properties": {
"Port": 80,
"Protocol": "HTTP",
"VpcId": {
"Ref": "VPCB9E5F0B4"
},
"TargetGroupAttributes": [],
"Targets": [],
"TargetType": "instance"
"TargetType": "instance",
"VpcId": {
"Ref": "VPCB9E5F0B4"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"ec2.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,17 @@
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
"Service": {
"Fn::Join": [
"",
[
"ec2.",
{
"Ref": "AWS::URLSuffix"
}
]
]
}
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export = {
{
Action: "sts:AssumeRole",
Effect: "Allow",
Principal: { Service: "autoscaling.amazonaws.com" }
Principal: { Service: { "Fn::Join": ["", ["autoscaling.", { Ref: "AWS::URLSuffix" }]] } }
}
],
}
Expand Down
Loading

0 comments on commit 946b444

Please sign in to comment.