diff --git a/packages/@aws-cdk/assets/test/integ.assets.directory.lit.expected.json b/packages/@aws-cdk/assets/test/integ.assets.directory.lit.expected.json index 0b84b721fffae..21728628fc03a 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.directory.lit.expected.json +++ b/packages/@aws-cdk/assets/test/integ.assets.directory.lit.expected.json @@ -30,18 +30,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "SampleAssetS3BucketE6B2908E" } @@ -52,50 +45,29 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "SampleAssetS3BucketE6B2908E" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "SampleAssetS3BucketE6B2908E" }, "/", { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "SampleAssetS3VersionKey3E106D34" - } - ] - } - ] - }, - "*" - ] + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "SampleAssetS3VersionKey3E106D34" + } + ] + } ] - } + }, + "*" ] ] } diff --git a/packages/@aws-cdk/assets/test/integ.assets.file.lit.expected.json b/packages/@aws-cdk/assets/test/integ.assets.file.lit.expected.json index c62111674435a..33c26403bc539 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.file.lit.expected.json +++ b/packages/@aws-cdk/assets/test/integ.assets.file.lit.expected.json @@ -30,18 +30,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "SampleAssetS3BucketE6B2908E" } @@ -52,50 +45,29 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "SampleAssetS3BucketE6B2908E" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "SampleAssetS3BucketE6B2908E" }, "/", { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "SampleAssetS3VersionKey3E106D34" - } - ] - } - ] - }, - "*" - ] + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "SampleAssetS3VersionKey3E106D34" + } + ] + } ] - } + }, + "*" ] ] } diff --git a/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.expected.json b/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.expected.json index c39bebcc10145..6eebb424ee837 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.expected.json +++ b/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.expected.json @@ -30,18 +30,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "MyFileS3BucketACE13C36" } @@ -52,50 +45,29 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "MyFileS3BucketACE13C36" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "MyFileS3BucketACE13C36" }, "/", { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "MyFileS3VersionKey568C3C9F" - } - ] - } - ] - }, - "*" - ] + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "MyFileS3VersionKey568C3C9F" + } + ] + } ] - } + }, + "*" ] ] } diff --git a/packages/@aws-cdk/assets/test/integ.assets.refs.lit.expected.json b/packages/@aws-cdk/assets/test/integ.assets.refs.lit.expected.json index 9539e0a25879a..e59927660b621 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.refs.lit.expected.json +++ b/packages/@aws-cdk/assets/test/integ.assets.refs.lit.expected.json @@ -61,8 +61,7 @@ "Fn::Join": [ "", [ - "https://", - "s3.", + "https://s3.", { "Ref": "AWS::Region" }, @@ -76,36 +75,29 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "SampleAssetS3VersionKey3E106D34" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "SampleAssetS3VersionKey3E106D34" - } - ] - } - ] - } - ] + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "SampleAssetS3VersionKey3E106D34" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "SampleAssetS3VersionKey3E106D34" + } + ] + } ] } ] @@ -137,18 +129,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "SampleAssetS3BucketE6B2908E" } @@ -159,50 +144,29 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "SampleAssetS3BucketE6B2908E" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "SampleAssetS3BucketE6B2908E" }, "/", { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "SampleAssetS3VersionKey3E106D34" - } - ] - } - ] - }, - "*" - ] + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "SampleAssetS3VersionKey3E106D34" + } + ] + } ] - } + }, + "*" ] ] } diff --git a/packages/@aws-cdk/assets/test/test.asset.ts b/packages/@aws-cdk/assets/test/test.asset.ts index b8b34de11f59a..f1e211c358749 100644 --- a/packages/@aws-cdk/assets/test/test.asset.ts +++ b/packages/@aws-cdk/assets/test/test.asset.ts @@ -73,22 +73,18 @@ export = { { Action: ["s3:GetObject*", "s3:GetBucket*", "s3:List*"], Resource: [ - {"Fn::Join": ["", ["arn", ":", {Ref: "AWS::Partition"}, ":", "s3", ":", "", ":", "", ":", {Ref: "MyAssetS3Bucket68C9B344"}]]}, - {"Fn::Join": [ "", [ - {"Fn::Join": ["", [ "arn", ":", {Ref: "AWS::Partition"}, ":", "s3", ":", "", ":", "", ":", {Ref: "MyAssetS3Bucket68C9B344"}]]}, - "/", - {"Fn::Join": ["", [ - {"Fn::Select": [ - 0, - {"Fn::Split": [ "||", { Ref: "MyAssetS3VersionKey68E1A45D"}]} - ]}, - "*" - ]]} - ]]} + { "Fn::Join": ["", ["arn:", {Ref: "AWS::Partition"}, ":s3:::", {Ref: "MyAssetS3Bucket68C9B344"}]] }, + { "Fn::Join": ["", + [ + "arn:", {Ref: "AWS::Partition"}, ":s3:::", {Ref: "MyAssetS3Bucket68C9B344"}, + "/", + { "Fn::Select": [0, { "Fn::Split": [ "||", { Ref: "MyAssetS3VersionKey68E1A45D" }] }] }, + "*" + ] + ] } ] } - ] - }})); + ]}})); test.done(); }, diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.expected.json b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.expected.json index 93459c98efb7d..e76050bfba5a0 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.expected.json +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.expected.json @@ -20,21 +20,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -72,14 +62,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -93,16 +80,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "booksapiDeploymentStageprod55D8E03E" - }, - "/GET/books" - ] - ] - } + "Ref": "booksapiDeploymentStageprod55D8E03E" + }, + "/GET/books" ] ] } @@ -120,14 +100,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -139,8 +116,7 @@ { "Ref": "booksapiE1885304" }, - "/", - "test-invoke-stage/GET/books" + "/test-invoke-stage/GET/books" ] ] } @@ -158,14 +134,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -179,16 +152,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "booksapiDeploymentStageprod55D8E03E" - }, - "/POST/books" - ] - ] - } + "Ref": "booksapiDeploymentStageprod55D8E03E" + }, + "/POST/books" ] ] } @@ -206,14 +172,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -225,8 +188,7 @@ { "Ref": "booksapiE1885304" }, - "/", - "test-invoke-stage/POST/books" + "/test-invoke-stage/POST/books" ] ] } @@ -252,21 +214,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -304,14 +256,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -325,16 +274,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "booksapiDeploymentStageprod55D8E03E" - }, - "/GET/books/{book_id}" - ] - ] - } + "Ref": "booksapiDeploymentStageprod55D8E03E" + }, + "/GET/books/{book_id}" ] ] } @@ -352,14 +294,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -371,8 +310,7 @@ { "Ref": "booksapiE1885304" }, - "/", - "test-invoke-stage/GET/books/{book_id}" + "/test-invoke-stage/GET/books/{book_id}" ] ] } @@ -390,14 +328,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -411,16 +346,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "booksapiDeploymentStageprod55D8E03E" - }, - "/DELETE/books/{book_id}" - ] - ] - } + "Ref": "booksapiDeploymentStageprod55D8E03E" + }, + "/DELETE/books/{book_id}" ] ] } @@ -438,14 +366,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -457,8 +382,7 @@ { "Ref": "booksapiE1885304" }, - "/", - "test-invoke-stage/DELETE/books/{book_id}" + "/test-invoke-stage/DELETE/books/{book_id}" ] ] } @@ -484,21 +408,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -536,14 +450,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -557,16 +468,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "booksapiDeploymentStageprod55D8E03E" - }, - "/*/" - ] - ] - } + "Ref": "booksapiDeploymentStageprod55D8E03E" + }, + "/*/" ] ] } @@ -584,14 +488,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -603,8 +504,7 @@ { "Ref": "booksapiE1885304" }, - "/", - "test-invoke-stage/*/" + "/test-invoke-stage/*/" ] ] } @@ -616,7 +516,7 @@ "Name": "books-api" } }, - "booksapiDeployment308B08F19d5655c7356bb9d23943b328416b2f5e": { + "booksapiDeployment308B08F1c828b08824c062376eba921738884f85": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { @@ -641,7 +541,7 @@ "Ref": "booksapiE1885304" }, "DeploymentId": { - "Ref": "booksapiDeployment308B08F19d5655c7356bb9d23943b328416b2f5e" + "Ref": "booksapiDeployment308B08F1c828b08824c062376eba921738884f85" }, "StageName": "prod" } @@ -666,21 +566,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" ] ] } @@ -722,37 +612,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "Hello4A628BD4", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "Hello4A628BD4", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -792,37 +667,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "BooksHandler3EB83358", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "BooksHandler3EB83358", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -847,37 +707,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "BooksHandler3EB83358", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "BooksHandler3EB83358", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -914,37 +759,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "BookHandlerF9638A7A", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "BookHandlerF9638A7A", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -969,37 +799,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "BookHandlerF9638A7A", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "BookHandlerF9638A7A", + "Arn" ] - } + }, + "/invocations" ] ] } diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.expected.json b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.expected.json index 4138766758c77..aac6799e40c09 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.expected.json +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.expected.json @@ -50,21 +50,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" ] ] } diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json index 24b0cedfd60d1..5d15ff5c7b253 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json @@ -6,7 +6,7 @@ "Name": "my-api" } }, - "myapiDeployment92F2CB49f9d1ede876fcb76aa1d523f34f91d373": { + "myapiDeployment92F2CB498cbe233ce6b744150b3f2d80a9c3dd24": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { @@ -37,7 +37,7 @@ "CacheClusterEnabled": true, "CacheClusterSize": "0.5", "DeploymentId": { - "Ref": "myapiDeployment92F2CB49f9d1ede876fcb76aa1d523f34f91d373" + "Ref": "myapiDeployment92F2CB498cbe233ce6b744150b3f2d80a9c3dd24" }, "Description": "beta stage", "MethodSettings": [ @@ -76,21 +76,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" ] ] } @@ -156,37 +146,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "MyHandler6B74D312", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "MyHandler6B74D312", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -283,37 +258,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "MyHandler6B74D312", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "MyHandler6B74D312", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -338,37 +298,22 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "MyHandler6B74D312", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "MyHandler6B74D312", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -395,21 +340,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -447,14 +382,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -468,16 +400,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "myapiDeploymentStagebeta96434BEB" - }, - "/GET/v1/toys" - ] - ] - } + "Ref": "myapiDeploymentStagebeta96434BEB" + }, + "/GET/v1/toys" ] ] } @@ -495,14 +420,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -514,8 +436,7 @@ { "Ref": "myapi4C7BF186" }, - "/", - "test-invoke-stage/GET/v1/toys" + "/test-invoke-stage/GET/v1/toys" ] ] } @@ -533,14 +454,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -554,16 +472,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "myapiDeploymentStagebeta96434BEB" - }, - "/GET/v1/books" - ] - ] - } + "Ref": "myapiDeploymentStagebeta96434BEB" + }, + "/GET/v1/books" ] ] } @@ -581,14 +492,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -600,8 +508,7 @@ { "Ref": "myapi4C7BF186" }, - "/", - "test-invoke-stage/GET/v1/books" + "/test-invoke-stage/GET/v1/books" ] ] } @@ -619,14 +526,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -640,16 +544,9 @@ }, "/", { - "Fn::Join": [ - "", - [ - { - "Ref": "myapiDeploymentStagebeta96434BEB" - }, - "/POST/v1/books" - ] - ] - } + "Ref": "myapiDeploymentStagebeta96434BEB" + }, + "/POST/v1/books" ] ] } @@ -667,14 +564,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { "Ref": "AWS::Region" }, @@ -686,8 +580,7 @@ { "Ref": "myapi4C7BF186" }, - "/", - "test-invoke-stage/POST/v1/books" + "/test-invoke-stage/POST/v1/books" ] ] } diff --git a/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts b/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts index 45f1ec60e1479..8596a37de0a2f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts @@ -46,37 +46,22 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "apigateway", - ":", + ":apigateway:", { "Ref": "AWS::Region" }, - ":", - "lambda", - ":", - "path", - "/", + ":lambda:path/2015-03-31/functions/", { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", - { - "Fn::GetAtt": [ - "handlerE1533BD5", - "Arn" - ] - }, - "/invocations" - ] + "Fn::GetAtt": [ + "handlerE1533BD5", + "Arn" ] - } + }, + "/invocations" ] ] } @@ -142,4 +127,4 @@ export = { test.done(); }, -}; \ No newline at end of file +}; diff --git a/packages/@aws-cdk/aws-apigateway/test/test.lambda.ts b/packages/@aws-cdk/aws-apigateway/test/test.lambda.ts index 8c2c9b8588fc0..fb1ba4bca4306 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.lambda.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.lambda.ts @@ -26,40 +26,25 @@ export = { Type: "AWS_PROXY", Uri: { "Fn::Join": [ - "", - [ - "arn", - ":", - { - Ref: "AWS::Partition" - }, - ":", - "apigateway", - ":", - { - Ref: "AWS::Region" - }, - ":", - "lambda", - ":", - "path", - "/", - { - "Fn::Join": [ - "", - [ - "2015-03-31/functions/", + "", + [ + "arn:", + { + Ref: "AWS::Partition" + }, + ":apigateway:", + { + Ref: "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", { "Fn::GetAtt": [ - "Handler886CB40B", - "Arn" + "Handler886CB40B", + "Arn" ] }, "/invocations" - ] ] - } - ] ] } } @@ -88,8 +73,8 @@ export = { "Fn::Join": [ "", [ - "arn", ":", { Ref: "AWS::Partition" }, ":", "execute-api", ":", { Ref: "AWS::Region" }, ":", { Ref: "AWS::AccountId" }, ":", - { Ref: "apiC8550315" }, "/", { "Fn::Join": [ "", [ { Ref: "apiDeploymentStageprod896C8101" }, "/GET/" ] ] } + "arn:", { Ref: "AWS::Partition" }, ":execute-api:", { Ref: "AWS::Region" }, ":", { Ref: "AWS::AccountId" }, ":", + { Ref: "apiC8550315" }, "/", { Ref: "apiDeploymentStageprod896C8101" }, "/GET/" ] ] } @@ -100,19 +85,15 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { Ref: "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { Ref: "AWS::Region" }, ":", { Ref: "AWS::AccountId" }, ":", { Ref: "apiC8550315" }, - "/", - "test-invoke-stage/GET/" + "/test-invoke-stage/GET/" ] ] } @@ -165,18 +146,15 @@ export = { "Fn::Join": [ "", [ - "arn", ":", + "arn:", { Ref: "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { Ref: "AWS::Region" }, ":", { Ref: "AWS::AccountId" }, ":", { Ref: "testapiD6451F70" }, - "/", - "test-invoke-stage/*/" + "/test-invoke-stage/*/" ] ] } @@ -187,37 +165,25 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", - { - Ref: "AWS::Partition" - }, - ":", - "execute-api", - ":", - { - Ref: "AWS::Region" - }, - ":", - { - Ref: "AWS::AccountId" - }, - ":", - { - Ref: "testapiD6451F70" - }, - "/", - { - "Fn::Join": [ - "", - [ - { - Ref: "testapiDeploymentStageprod5C9E92A4" - }, - "/*/" - ] - ] - } + "arn:", + { + Ref: "AWS::Partition" + }, + ":execute-api:", + { + Ref: "AWS::Region" + }, + ":", + { + Ref: "AWS::AccountId" + }, + ":", + { + Ref: "testapiD6451F70" + }, + "/", + { Ref: "testapiDeploymentStageprod5C9E92A4" }, + "/*/" ] ] } diff --git a/packages/@aws-cdk/aws-apigateway/test/test.method.ts b/packages/@aws-cdk/aws-apigateway/test/test.method.ts index 031d4f748741a..5336ab439622f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.method.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.method.ts @@ -78,8 +78,8 @@ export = { "Fn::Join": [ "", [ - "arn", ":", { Ref: "AWS::Partition" }, ":", "apigateway", ":", - { Ref: "AWS::Region" }, ":", "s3", ":", "path", "/", "bucket/key" + "arn:", { Ref: "AWS::Partition" }, ":apigateway:", + { Ref: "AWS::Region" }, ":s3:path/bucket/key" ] ] } @@ -133,19 +133,17 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { Ref: "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { Ref: "AWS::Region" }, ":", { Ref: "AWS::AccountId" }, ":", { Ref: "testapiD6451F70" }, "/", - { "Fn::Join": [ "", [ { Ref: "testapiDeploymentStageprod5C9E92A4" }, "/POST/" ] ] } + { Ref: "testapiDeploymentStageprod5C9E92A4" }, + "/POST/" ] ] }); @@ -169,19 +167,15 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { Ref: "AWS::Partition" }, - ":", - "execute-api", - ":", + ":execute-api:", { Ref: "AWS::Region" }, ":", { Ref: "AWS::AccountId" }, ":", { Ref: "testapiD6451F70" }, - "/", - "test-invoke-stage/POST/" + "/test-invoke-stage/POST/" ] ] }); @@ -241,7 +235,7 @@ export = { // THEN expect(stack).to(haveResource('AWS::ApiGateway::Method', { Integration: { - Credentials: { "Fn::Join": [ "", [ "arn", ":", { Ref: "AWS::Partition" }, ":", "iam", ":", "", ":", "*", ":", "user", "/", "*" ] ] } + Credentials: { "Fn::Join": [ "", [ "arn:", { Ref: "AWS::Partition" }, ":iam::*:user/*" ] ] } } })); test.done(); diff --git a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts index c27a4dc00efff..0e5f332405abc 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts @@ -85,21 +85,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { Ref: "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" ] ] } @@ -469,19 +459,15 @@ export = { // THEN test.deepEqual(cdk.resolve(arn), { 'Fn::Join': [ '', - [ 'arn', - ':', + [ 'arn:', { Ref: 'AWS::Partition' }, - ':', - 'execute-api', - ':', + ':execute-api:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':', { Ref: 'apiC8550315' }, - '/', - 'stage/method/path' ] ] }); + '/stage/method/path' ] ] }); test.done(); }, @@ -506,19 +492,17 @@ export = { // THEN test.deepEqual(cdk.resolve(method.methodArn), { 'Fn::Join': [ '', - [ 'arn', - ':', + [ 'arn:', { Ref: 'AWS::Partition' }, - ':', - 'execute-api', - ':', + ':execute-api:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':', { Ref: 'apiC8550315' }, '/', - { 'Fn::Join': [ '', [ { Ref: 'apiDeploymentStageprod896C8101' }, '/*/' ] ] } ] ] }); + { Ref: 'apiDeploymentStageprod896C8101' }, + '/*/'] ] }); test.done(); }, diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json index 5b543d5de14b5..ec26b05f179ab 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json @@ -32,21 +32,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -88,4 +78,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts b/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts index e460dce095f8e..668699634cde0 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts @@ -36,8 +36,7 @@ export = { }, "ManagedPolicyArns": [ { "Fn::Join": [ "", [ - "arn", ":", { "Ref": "AWS::Partition" }, ":", "iam", ":", "", ":", "aws", ":", "policy", "/", - "service-role/AWSLambdaBasicExecutionRole" ] ]} + "arn:", { "Ref": "AWS::Partition" }, ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ]} ] } }, diff --git a/packages/@aws-cdk/aws-codebuild/package.json b/packages/@aws-cdk/aws-codebuild/package.json index 58228c445f758..6850e7036135e 100644 --- a/packages/@aws-cdk/aws-codebuild/package.json +++ b/packages/@aws-cdk/aws-codebuild/package.json @@ -57,6 +57,7 @@ "devDependencies": { "@aws-cdk/assert": "^0.13.0", "@aws-cdk/aws-sns": "^0.13.0", + "@aws-cdk/aws-sqs": "^0.13.0", "aws-sdk": "^2.259.1", "cdk-build-tools": "^0.13.0", "cdk-integ-tools": "^0.13.0", diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json index 42e04c47317a6..dd6a562be8be1 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json @@ -52,8 +52,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -71,14 +70,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -86,19 +82,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -107,14 +93,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -122,19 +105,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json index 6133bf2f84897..0d10cf63a29ee 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json @@ -49,8 +49,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -68,14 +67,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -83,19 +79,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -104,14 +90,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -119,19 +102,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] @@ -176,8 +149,7 @@ { "Ref": "MyBucketF68F3FF0" }, - "/", - "path/to/my/source.zip" + "/path/to/my/source.zip" ] ] }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json index efb9d2ba2fe5e..82ec4b39bd6cb 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json @@ -111,14 +111,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -126,19 +123,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -147,14 +134,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -162,19 +146,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] @@ -329,14 +303,57 @@ ] } }, + "MyQueueE6CA6235": { + "Type": "AWS::SQS::Queue" + }, + "MyQueuePolicy6BBEDDAC": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Ref": "MyTopic86869434" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "sns.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "MyQueueE6CA6235", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "MyQueueE6CA6235" + } + ] + } + }, "MyTopic86869434": { "Type": "AWS::SNS::Topic" }, - "MyTopicPersonal828A6935": { + "MyTopicMyQueueSubscription3245B11E": { "Type": "AWS::SNS::Subscription", "Properties": { - "Endpoint": "benisrae@amazon.com", - "Protocol": "email", + "Endpoint": { + "Fn::GetAtt": [ + "MyQueueE6CA6235", + "Arn" + ] + }, + "Protocol": "sqs", "TopicArn": { "Ref": "MyTopic86869434" } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts index 9d2080b85d8e9..213421c45ea09 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node import codecommit = require('@aws-cdk/aws-codecommit'); import sns = require('@aws-cdk/aws-sns'); +import sqs = require('@aws-cdk/aws-sqs'); import cdk = require('@aws-cdk/cdk'); import { CodeCommitSource, Project } from '../lib'; @@ -11,8 +12,10 @@ const stack = new cdk.Stack(app, 'aws-cdk-codebuild-events'); const repo = new codecommit.Repository(stack, 'MyRepo', { repositoryName: 'aws-cdk-codebuild-events' }); const project = new Project(stack, 'MyProject', { source: new CodeCommitSource(repo) }); +const queue = new sqs.Queue(stack, 'MyQueue'); + const topic = new sns.Topic(stack, 'MyTopic'); -topic.subscribeEmail('Personal', 'benisrae@amazon.com'); +topic.subscribeQueue(queue); // this will send an email with the JSON event for every state change of this // build project. diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json index dc13039e82083..3a4207a879e11 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json @@ -44,18 +44,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "BundleS3Bucket0EFC11B0" } @@ -66,50 +59,29 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "BundleS3Bucket0EFC11B0" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "BundleS3Bucket0EFC11B0" }, "/", { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "BundleS3VersionKey720F2199" - } - ] - } - ] - }, - "*" - ] + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "BundleS3VersionKey720F2199" + } + ] + } ] - } + }, + "*" ] ] } @@ -127,14 +99,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -142,19 +111,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -163,14 +122,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -178,19 +134,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index ceb14b97ac873..1cc894514ca04 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -53,14 +53,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -68,19 +65,9 @@ export = { { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -89,14 +76,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -104,19 +88,9 @@ export = { { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] @@ -227,14 +201,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -242,19 +213,9 @@ export = { { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -263,14 +224,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -278,19 +236,9 @@ export = { { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] @@ -404,8 +352,7 @@ export = { "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -423,14 +370,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -438,19 +382,9 @@ export = { { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" } ] ] @@ -459,14 +393,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -474,19 +405,9 @@ export = { { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyProject39F7B0AE" - } - ] - ] + "Ref": "MyProject39F7B0AE" }, ":*" ] @@ -531,8 +452,7 @@ export = { { "Ref": "MyBucketF68F3FF0" }, - "/", - "path/to/source.zip" + "/path/to/source.zip" ] ] }, @@ -756,7 +676,7 @@ export = { environment: { environmentVariables: { FOO: { value: '1234' }, - BAR: { value: new cdk.FnConcat('111', '222'), type: codebuild.BuildEnvironmentVariableType.ParameterStore } + BAR: { value: new cdk.FnConcat('111', { twotwotwo: '222' }), type: codebuild.BuildEnvironmentVariableType.ParameterStore } } }, environmentVariables: { @@ -793,7 +713,7 @@ export = { "", [ "111", - "222" + { twotwotwo: "222" } ] ] }, diff --git a/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.expected.json b/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.expected.json index 78d6d61b60339..a64931c5829e0 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.expected.json +++ b/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.expected.json @@ -498,28 +498,13 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::aws-codedeploy-", { - "Fn::Join": [ - "", - [ - "aws-codedeploy-", - { - "Ref": "AWS::Region" - } - ] - ] + "Ref": "AWS::Region" } ] ] @@ -528,38 +513,15 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Fn::Join": [ - "", - [ - "aws-codedeploy-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::aws-codedeploy-", + { + "Ref": "AWS::Region" }, - "/", - "latest/*" + "/latest/*" ] ] } @@ -793,4 +755,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.expected.json index 44c5ab51b6830..2b78411b8811d 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.expected.json @@ -53,8 +53,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -93,14 +92,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "cloudformation", - ":", + ":cloudformation:", { "Ref": "AWS::Region" }, @@ -108,10 +104,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "stack", - "/", - "OurStack/*" + ":stack/OurStack/*" ] ] } @@ -132,14 +125,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "cloudformation", - ":", + ":cloudformation:", { "Ref": "AWS::Region" }, @@ -147,10 +137,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "stack", - "/", - "OurStack/*" + ":stack/OurStack/*" ] ] } @@ -167,14 +154,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "cloudformation", - ":", + ":cloudformation:", { "Ref": "AWS::Region" }, @@ -182,10 +166,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "stack", - "/", - "OurStack/*" + ":stack/OurStack/*" ] ] } @@ -364,4 +345,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.expected.json index 47a30bf5f1139..c4eba9bf3313a 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.expected.json @@ -53,8 +53,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -84,8 +83,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -218,21 +216,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -284,4 +272,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.expected.json index 7c61e17478119..ac56d1f1bbb6a 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.expected.json @@ -53,8 +53,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -84,8 +83,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -108,14 +106,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "cloudformation", - ":", + ":cloudformation:", { "Ref": "AWS::Region" }, @@ -123,10 +118,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "stack", - "/", - "IntegTest-TestActionStack/*" + ":stack/IntegTest-TestActionStack/*" ] ] } @@ -147,14 +139,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "cloudformation", - ":", + ":cloudformation:", { "Ref": "AWS::Region" }, @@ -162,10 +151,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "stack", - "/", - "IntegTest-TestActionStack/*" + ":stack/IntegTest-TestActionStack/*" ] ] } @@ -291,4 +277,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.expected.json index d2e75b8691c6d..5ff0eed026a50 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.expected.json @@ -60,8 +60,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -261,14 +260,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -276,19 +272,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyBuildProject30DB9D6E" - } - ] - ] + "Ref": "MyBuildProject30DB9D6E" } ] ] @@ -297,14 +283,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -312,19 +295,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "MyBuildProject30DB9D6E" - } - ] - ] + "Ref": "MyBuildProject30DB9D6E" }, ":*" ] @@ -359,8 +332,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -390,8 +362,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -432,4 +403,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.expected.json index 36b68b9f5b721..f00592f0ee917 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.expected.json @@ -60,8 +60,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -166,4 +165,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.expected.json index 6d331d9f379e3..4dc1147ef370d 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.expected.json @@ -117,8 +117,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -148,8 +147,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -165,14 +163,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codedeploy", - ":", + ":codedeploy:", { "Ref": "AWS::Region" }, @@ -180,10 +175,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "application", - ":", - "IntegTestDeployApp" + ":application:IntegTestDeployApp" ] ] } @@ -198,14 +190,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codedeploy", - ":", + ":codedeploy:", { "Ref": "AWS::Region" }, @@ -213,10 +202,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "deploymentgroup", - ":", - "IntegTestDeployApp/IntegTestDeploymentGroup" + ":deploymentgroup:IntegTestDeployApp/IntegTestDeploymentGroup" ] ] } @@ -228,14 +214,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codedeploy", - ":", + ":codedeploy:", { "Ref": "AWS::Region" }, @@ -243,10 +226,7 @@ { "Ref": "AWS::AccountId" }, - ":", - "deploymentconfig", - ":", - "*" + ":deploymentconfig:*" ] ] } @@ -339,4 +319,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.expected.json b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.expected.json index 71f870df83040..4667b873e5679 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.expected.json +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.expected.json @@ -53,8 +53,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -200,14 +199,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codepipeline", - ":", + ":codepipeline:", { "Ref": "AWS::Region" }, @@ -257,14 +253,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codepipeline", - ":", + ":codepipeline:", { "Ref": "AWS::Region" }, @@ -312,14 +305,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codepipeline", - ":", + ":codepipeline:", { "Ref": "AWS::Region" }, @@ -399,14 +389,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -414,19 +401,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "BuildProject097C5DB7" - } - ] - ] + "Ref": "BuildProject097C5DB7" } ] ] @@ -435,14 +412,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "logs", - ":", + ":logs:", { "Ref": "AWS::Region" }, @@ -450,19 +424,9 @@ { "Ref": "AWS::AccountId" }, - ":", - "log-group", - ":", + ":log-group:/aws/codebuild/", { - "Fn::Join": [ - "", - [ - "/aws/codebuild/", - { - "Ref": "BuildProject097C5DB7" - } - ] - ] + "Ref": "BuildProject097C5DB7" }, ":*" ] @@ -497,8 +461,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -568,4 +531,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts index 8b6c20f74f5cd..67c41f552d255 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts @@ -177,14 +177,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "codepipeline", - ":", + ":codepipeline:", { "Ref": "AWS::Region" }, diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.load-balancer.ts index d7d91f43c4adb..d1a4de47b3f4d 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.load-balancer.ts @@ -116,7 +116,7 @@ export = { { Action: "s3:PutObject", Principal: { AWS: { "Fn::Join": [ "", [ "arn:", { Ref: "AWS::Partition" }, ":iam::127311923021:root" ] ] } }, - Resource: { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "AccessLoggingBucketA6D88F29", "Arn" ] }, "/", "", "*" ] ] } + Resource: { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "AccessLoggingBucketA6D88F29", "Arn" ] }, "/*" ] ] } } ] } diff --git a/packages/@aws-cdk/aws-events/test/test.rule.ts b/packages/@aws-cdk/aws-events/test/test.rule.ts index 161bbac169b30..6343e7edfcaf0 100644 --- a/packages/@aws-cdk/aws-events/test/test.rule.ts +++ b/packages/@aws-cdk/aws-events/test/test.rule.ts @@ -275,17 +275,7 @@ export = { "Arn": "ARN1", "Id": "T1", "InputTransformer": { - "InputTemplate": { - "Fn::Join": [ - "", - [ - "\"", - "a", - "b", - "\"" - ] - ] - } + "InputTemplate": "\"ab\"" }, "KinesisParameters": { "PartitionKeyPath": "partitionKeyPath" @@ -305,17 +295,7 @@ export = { "Arn": "ARN4", "Id": "T4", "InputTransformer": { - "InputTemplate": { - "Fn::Join": [ - " ", - [ - "\"", - "hello", - "\"world\"", - "\"" - ] - ] - } + "InputTemplate": "\" hello \"world\" \"" } } ] diff --git a/packages/@aws-cdk/aws-iam/test/test.managed-policy.ts b/packages/@aws-cdk/aws-iam/test/test.managed-policy.ts index 4f5de46bf9664..49989eecc870a 100644 --- a/packages/@aws-cdk/aws-iam/test/test.managed-policy.ts +++ b/packages/@aws-cdk/aws-iam/test/test.managed-policy.ts @@ -8,19 +8,9 @@ export = { test.deepEqual(cdk.resolve(mp.policyArn), { "Fn::Join": ['', [ - 'arn', - ':', + 'arn:', { Ref: 'AWS::Partition' }, - ':', - 'iam', - ':', - '', - ':', - 'aws', - ':', - 'policy', - '/', - 'service-role/SomePolicy' + ':iam::aws:policy/service-role/SomePolicy' ]] }); diff --git a/packages/@aws-cdk/aws-iam/test/test.policy-document.ts b/packages/@aws-cdk/aws-iam/test/test.policy-document.ts index f43bb5e41c6a0..77c6036d97c2d 100644 --- a/packages/@aws-cdk/aws-iam/test/test.policy-document.ts +++ b/packages/@aws-cdk/aws-iam/test/test.policy-document.ts @@ -11,7 +11,7 @@ export = { p.addResource('yourQueue'); p.addAllResources(); - p.addAwsAccountPrincipal(new FnConcat('my', 'account', 'name').toString()); + p.addAwsAccountPrincipal(new FnConcat('my', { account: 'account' }, 'name').toString()); p.limitToAccount('12221121221'); test.deepEqual(resolve(p), { Action: @@ -26,9 +26,9 @@ export = { [ '', [ 'arn:', { Ref: 'AWS::Partition' }, - ':iam::', - { 'Fn::Join': [ '', [ 'my', 'account', 'name' ] ] }, - ':root' ] ] } }, + ':iam::my', + { account: 'account' }, + 'name:root' ] ] } }, Condition: { StringEquals: { 'sts:ExternalId': '12221121221' } } }); test.done(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.expected.json b/packages/@aws-cdk/aws-lambda/test/integ.assets.file.expected.json index 866f127940b61..70dc60f4fc27e 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.expected.json +++ b/packages/@aws-cdk/aws-lambda/test/integ.assets.file.expected.json @@ -20,21 +20,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -106,4 +96,4 @@ "Description": "S3 key for asset version \"lambda-test-assets-file/MyLambda/Code\"" } } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.expected.json b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.expected.json index e983ee0f5922f..d7f6c1d29ee8b 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.expected.json +++ b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.expected.json @@ -20,21 +20,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -106,4 +96,4 @@ "Description": "S3 key for asset version \"lambda-test-assets/MyLambda/Code\"" } } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.expected.json b/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.expected.json index 67b30b027eb0f..0f51afb91b10f 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.expected.json @@ -65,21 +65,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -198,21 +188,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } diff --git a/packages/@aws-cdk/aws-lambda/test/integ.events.expected.json b/packages/@aws-cdk/aws-lambda/test/integ.events.expected.json index 82097f0e2e730..8ec2c8ab346f2 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.events.expected.json +++ b/packages/@aws-cdk/aws-lambda/test/integ.events.expected.json @@ -20,21 +20,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.expected.json b/packages/@aws-cdk/aws-lambda/test/integ.lambda.expected.json index 1fa4ce735d35b..72c4017892df1 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.expected.json +++ b/packages/@aws-cdk/aws-lambda/test/integ.lambda.expected.json @@ -20,21 +20,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.expected.json b/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.expected.json index 84f1345239c11..3862d4993d222 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.expected.json +++ b/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.expected.json @@ -57,6 +57,18 @@ } } }, + "VPCPublicSubnet1DefaultRoute91CEF279": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, "VPCPublicSubnet1EIP6AD938E8": { "Type": "AWS::EC2::EIP", "Properties": { @@ -83,18 +95,6 @@ ] } }, - "VPCPublicSubnet1DefaultRoute91CEF279": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VPCPublicSubnet1RouteTableFEE4B781" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VPCIGWB7E252D3" - } - } - }, "VPCPublicSubnet2Subnet74179F39": { "Type": "AWS::EC2::Subnet", "Properties": { @@ -137,6 +137,18 @@ } } }, + "VPCPublicSubnet2DefaultRouteB7481BBA": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, "VPCPublicSubnet2EIP4947BC00": { "Type": "AWS::EC2::EIP", "Properties": { @@ -163,18 +175,6 @@ ] } }, - "VPCPublicSubnet2DefaultRouteB7481BBA": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VPCIGWB7E252D3" - } - } - }, "VPCPrivateSubnet1Subnet8BCA10E0": { "Type": "AWS::EC2::Subnet", "Properties": { @@ -325,21 +325,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] }, @@ -347,21 +337,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaVPCAccessExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" ] ] } diff --git a/packages/@aws-cdk/aws-lambda/test/test.lambda.ts b/packages/@aws-cdk/aws-lambda/test/test.lambda.ts index 7ee63e038a7f0..73a919afacfb8 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.lambda.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.lambda.ts @@ -32,7 +32,7 @@ export = { ManagedPolicyArns: // arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole // tslint:disable-next-line:max-line-length - [{'Fn::Join': ['', ['arn', ':', {Ref: 'AWS::Partition'}, ':', 'iam', ':', '', ':', 'aws', ':', 'policy', '/', 'service-role/AWSLambdaBasicExecutionRole']]}], + [{'Fn::Join': ['', ['arn:', {Ref: 'AWS::Partition'}, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']]}], }}, MyLambdaCCE802FB: { Type: 'AWS::Lambda::Function', @@ -65,7 +65,7 @@ export = { Version: '2012-10-17' }, ManagedPolicyArns: // tslint:disable-next-line:max-line-length - [{'Fn::Join': ['', ['arn', ':', {Ref: 'AWS::Partition'}, ':', 'iam', ':', '', ':', 'aws', ':', 'policy', '/', 'service-role/AWSLambdaBasicExecutionRole']]}], + [{'Fn::Join': ['', ['arn:', {Ref: 'AWS::Partition'}, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']]}], }}, MyLambdaServiceRoleDefaultPolicy5BBC6F68: { Type: "AWS::IAM::Policy", @@ -141,7 +141,7 @@ export = { }, "ManagedPolicyArns": // tslint:disable-next-line:max-line-length - [{'Fn::Join': ['', ['arn', ':', {Ref: 'AWS::Partition'}, ':', 'iam', ':', '', ':', 'aws', ':', 'policy', '/', 'service-role/AWSLambdaBasicExecutionRole']]}], + [{'Fn::Join': ['', ['arn:', {Ref: 'AWS::Partition'}, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']]}], } }, "MyLambdaCCE802FB": { @@ -360,21 +360,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -481,21 +471,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -601,21 +581,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -687,21 +657,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -809,21 +769,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } diff --git a/packages/@aws-cdk/aws-lambda/test/test.singleton-lambda.ts b/packages/@aws-cdk/aws-lambda/test/test.singleton-lambda.ts index 054ee63a44ace..30aff6e53b7f9 100644 --- a/packages/@aws-cdk/aws-lambda/test/test.singleton-lambda.ts +++ b/packages/@aws-cdk/aws-lambda/test/test.singleton-lambda.ts @@ -37,8 +37,7 @@ export = { }, ManagedPolicyArns: [ { - "Fn::Join": [ "", [ "arn", ":", { Ref: "AWS::Partition" }, ":", "iam", ":", "", - ":", "aws", ":", "policy", "/", "service-role/AWSLambdaBasicExecutionRole" ] ] + "Fn::Join": [ "", [ "arn:", { Ref: "AWS::Partition" }, ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } ] } diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json index 5f6678f003ed9..5fcdf8058d375 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json @@ -30,8 +30,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -111,21 +110,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -149,18 +138,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "DeployMeAssetS3Bucket646A811D" } @@ -171,30 +153,15 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "DeployMeAssetS3Bucket646A811D" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "DeployMeAssetS3Bucket646A811D" }, - "/", - "*" + "/*" ] ] } @@ -227,8 +194,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -246,18 +212,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "s3", - ":", - "", - ":", - "", - ":", + ":s3:::", { "Ref": "DeployWithPrefixAssetS3Bucket8B33F071" } @@ -268,30 +227,15 @@ "Fn::Join": [ "", [ + "arn:", { - "Fn::Join": [ - "", - [ - "arn", - ":", - { - "Ref": "AWS::Partition" - }, - ":", - "s3", - ":", - "", - ":", - "", - ":", - { - "Ref": "DeployWithPrefixAssetS3Bucket8B33F071" - } - ] - ] + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Ref": "DeployWithPrefixAssetS3Bucket8B33F071" }, - "/", - "*" + "/*" ] ] } @@ -324,8 +268,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -480,4 +423,4 @@ "Description": "S3 key for asset version \"test-bucket-deployments-1/DeployWithPrefix/Asset\"" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3-deployment/test/test.bucket-deployment.ts b/packages/@aws-cdk/aws-s3-deployment/test/test.bucket-deployment.ts index 313743981c078..60f7ae30c5591 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/test.bucket-deployment.ts +++ b/packages/@aws-cdk/aws-s3-deployment/test/test.bucket-deployment.ts @@ -158,8 +158,7 @@ export = { "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -192,8 +191,7 @@ export = { "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -211,4 +209,4 @@ export = { })); test.done(); }, -}; \ No newline at end of file +}; diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json b/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json index 5f0af8b0f8c9c..2175996d83ed2 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json @@ -136,8 +136,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -183,8 +182,7 @@ "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -202,4 +200,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json index 5e673cd26b405..f6aa6c0d2369b 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json @@ -10,8 +10,7 @@ "Fn::Join": [ "", [ - "https://", - "s3.", + "https://s3.", { "Ref": "AWS::Region" }, @@ -35,8 +34,7 @@ "Fn::Join": [ "", [ - "https://", - "s3.", + "https://s3.", { "Ref": "AWS::Region" }, @@ -48,8 +46,7 @@ { "Ref": "MyBucketF68F3FF0" }, - "/", - "myfolder/myfile.txt" + "/myfolder/myfile.txt" ] ] }, @@ -58,4 +55,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3/test/integ.notifications.expected.json b/packages/@aws-cdk/aws-s3/test/integ.notifications.expected.json index 5a06b33722f90..cb240ee087adf 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.notifications.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.notifications.expected.json @@ -166,21 +166,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -270,4 +260,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index 104adae3e287e..53a78d40ddf81 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -262,7 +262,7 @@ export = { Resource: { 'Fn::Join': [ '', - [ { 'Fn::GetAtt': [ 'MyBucketF68F3FF0', 'Arn' ] }, '/', 'hello/world' ] + [ { 'Fn::GetAtt': [ 'MyBucketF68F3FF0', 'Arn' ] }, '/hello/world' ] ] } }); @@ -290,8 +290,7 @@ export = { '', [ { 'Fn::GetAtt': [ 'MyBucketF68F3FF0', 'Arn' ] }, - '/', - 'home/', + '/home/', { Ref: 'MyTeam01DD6685' }, '/', { Ref: 'MyUserDC45028B' }, @@ -399,17 +398,7 @@ export = { { "Action": "s3:*", "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:aws:s3:::my-bucket", - "/", - "my/folder/", - "my-bucket" - ] - ] - } + "Resource": "arn:aws:s3:::my-bucket/my/folder/my-bucket" } ], "Version": "2012-10-17" @@ -503,11 +492,8 @@ export = { "Fn::Join": [ "", [ - { - "Fn::ImportValue": "S1:MyBucketBucketArnE260558C" - }, - "/", - "*" + { "Fn::ImportValue": "S1:MyBucketBucketArnE260558C" }, + "/*" ] ] } @@ -570,8 +556,7 @@ export = { "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -643,8 +628,7 @@ export = { "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -797,8 +781,7 @@ export = { "Arn" ] }, - "/", - "*" + "/*" ] ] } @@ -936,8 +919,7 @@ export = { { "Fn::ImportValue": "MyBucketBucketArnE260558C" }, - "/", - "*" + "/*" ] ] } @@ -980,8 +962,7 @@ export = { "Fn::Join": [ "", [ - "https://", - "s3.", + "https://s3.", { "Ref": "AWS::Region" }, @@ -1005,8 +986,7 @@ export = { "Fn::Join": [ "", [ - "https://", - "s3.", + "https://s3.", { "Ref": "AWS::Region" }, @@ -1018,8 +998,7 @@ export = { { "Ref": "MyBucketF68F3FF0" }, - "/", - "my/file.txt" + "/my/file.txt" ] ] }, @@ -1032,8 +1011,7 @@ export = { "Fn::Join": [ "", [ - "https://", - "s3.", + "https://s3.", { "Ref": "AWS::Region" }, @@ -1045,8 +1023,7 @@ export = { { "Ref": "MyBucketF68F3FF0" }, - "/", - "your/file.txt" + "/your/file.txt" ] ] }, @@ -1077,7 +1054,7 @@ export = { "Action": "s3:GetObject", "Effect": "Allow", "Principal": "*", - "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/", "*" ] ] } + "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/*" ] ] } } ], "Version": "2012-10-17" @@ -1102,7 +1079,7 @@ export = { "Action": "s3:GetObject", "Effect": "Allow", "Principal": "*", - "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/", "only/access/these/*" ] ] } + "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/only/access/these/*" ] ] } } ], "Version": "2012-10-17" @@ -1127,7 +1104,7 @@ export = { "Action": [ "s3:GetObject", "s3:PutObject" ], "Effect": "Allow", "Principal": "*", - "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/", "*" ] ] } + "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/*" ] ] } } ], "Version": "2012-10-17" @@ -1153,7 +1130,7 @@ export = { "Action": "s3:GetObject", "Effect": "Allow", "Principal": "*", - "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/", "*" ] ] }, + "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "bC3BBCC65", "Arn" ] }, "/*" ] ] }, "Condition": { "IpAddress": { "aws:SourceIp": "54.240.143.0/24" } } diff --git a/packages/@aws-cdk/aws-s3/test/test.util.ts b/packages/@aws-cdk/aws-s3/test/test.util.ts index fe647c2275c80..68a2e3ca756e1 100644 --- a/packages/@aws-cdk/aws-s3/test/test.util.ts +++ b/packages/@aws-cdk/aws-s3/test/test.util.ts @@ -14,17 +14,9 @@ export = { const bucketName = 'hello'; test.deepEqual(cdk.resolve(parseBucketArn({ bucketName })), { 'Fn::Join': [ '', - [ 'arn', - ':', + [ 'arn:', { Ref: 'AWS::Partition' }, - ':', - 's3', - ':', - '', - ':', - '', - ':', - 'hello' ] ] }); + ':s3:::hello' ] ] }); test.done(); }, @@ -49,7 +41,7 @@ export = { }, 'undefined if cannot extract name from a non-string arn'(test: Test) { - const bucketArn = new cdk.FnConcat('arn:aws:s3:::', 'my-bucket').toString(); + const bucketArn = new cdk.FnConcat('arn:aws:s3:::', { Ref: 'my-bucket' }).toString(); test.deepEqual(cdk.resolve(parseBucketName({ bucketArn })), undefined); test.done(); }, diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.expected.json b/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.expected.json index f282f4ce68fad..6e70240782358 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.expected.json @@ -153,21 +153,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -214,4 +204,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.expected.json b/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.expected.json index 4164cc8b24d84..800d7778834ae 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.expected.json +++ b/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.expected.json @@ -34,7 +34,7 @@ "Version": "2012-10-17" }, "ManagedPolicyArns": [ - {"Fn::Join":["",["arn",":",{"Ref":"AWS::Partition"},":","iam",":","",":","aws",":","policy","/","service-role/AWSLambdaBasicExecutionRole"]]} + {"Fn::Join":["",["arn:",{"Ref":"AWS::Partition"},":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]]} ] } }, diff --git a/packages/@aws-cdk/aws-sns/test/test.sns.ts b/packages/@aws-cdk/aws-sns/test/test.sns.ts index 9a45223a3c56e..c05172cc0da19 100644 --- a/packages/@aws-cdk/aws-sns/test/test.sns.ts +++ b/packages/@aws-cdk/aws-sns/test/test.sns.ts @@ -265,8 +265,7 @@ export = { "Version": "2012-10-17" }, "ManagedPolicyArns": [ - { "Fn::Join": ["", ["arn", ":", {"Ref": "AWS::Partition"}, ":", "iam", ":", "", ":", "aws", ":", "policy", "/", - "service-role/AWSLambdaBasicExecutionRole"]]} + { "Fn::Join": ["", ["arn:", {"Ref": "AWS::Partition"}, ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]]} ] } }, @@ -458,21 +457,11 @@ export = { "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } diff --git a/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.expected.json b/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.expected.json index 9bca049124ab9..9419ad8279974 100644 --- a/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.expected.json @@ -131,21 +131,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -345,4 +335,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts index 2b64f876f9fad..9ee988e51cf01 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts @@ -1,3 +1,4 @@ +import { resolve, Token, unresolved } from '../core/tokens'; import { CloudFormationToken, isIntrinsic } from './cloudformation-token'; // tslint:disable:max-line-length @@ -82,6 +83,11 @@ export class FnImportValue extends Fn { * with no delimiter. */ export class FnJoin extends Fn { + private readonly delimiter: string; + private readonly listOfValues: any[]; + // Cache for the result of resolveValues() - since it otherwise would be computed several times + private _resolvedValues?: any[]; + /** * Creates an ``Fn::Join`` function. * @param delimiter The value you want to occur between fragments. The delimiter will occur between fragments only. @@ -92,60 +98,67 @@ export class FnJoin extends Fn { if (listOfValues.length === 0) { throw new Error(`FnJoin requires at least one value to be provided`); } - super('Fn::Join', [ delimiter, listOfValues ]); + // Passing the values as a token, optimization requires resolving stringified tokens, we should be deferred until + // this token is itself being resolved. + super('Fn::Join', [ delimiter, new Token(() => this.resolveValues()) ]); + this.delimiter = delimiter; + this.listOfValues = listOfValues; } -} -/** - * Alias for ``FnJoin('', listOfValues)``. - */ -export class FnConcat extends FnJoin { - private readonly listOfValues: any[]; + public resolve(): any { + if (this.resolveValues().length === 1) { + return this.resolveValues()[0]; + } + return super.resolve(); + } /** - * Creates an ``Fn::Join`` function with an empty delimiter. - * @param listOfValues The list of values to concatenate. + * Optimization: if an Fn::Join is nested in another one and they share the same delimiter, then flatten it up. Also, + * if two concatenated elements are literal strings (not tokens), then pre-concatenate them with the delimiter, to + * generate shorter output. */ - constructor(...listOfValues: any[]) { - // Optimization: if any of the input arguments is also a FnConcat, - // splice their list of values into the current FnConcat. 'instanceof' - // can fail, but we do not depend depend on this for correctness. - // - // Do the same for resolved intrinsics, so we can detect this - // happening both at Token as well as at CloudFormation level. + private resolveValues() { + if (this._resolvedValues) { return this._resolvedValues; } + const resolvedValues = [...this.listOfValues.map(e => resolve(e))]; let i = 0; - while (i < listOfValues.length) { - const el = listOfValues[i]; - if (el instanceof FnConcat) { - listOfValues.splice(i, 1, ...el.listOfValues); - i += el.listOfValues.length; - } else if (isConcatIntrinsic(el)) { - const values = concatIntrinsicValues(el); - listOfValues.splice(i, 1, ...values); - i += values; + while (i < resolvedValues.length) { + const el = resolvedValues[i]; + if (isFnJoinIntrinsicWithSameDelimiter.call(this, el)) { + resolvedValues.splice(i, 1, ...el['Fn::Join'][1]); + } else if (i > 0 && isPlainString(resolvedValues[i - 1]) && isPlainString(resolvedValues[i])) { + resolvedValues[i - 1] += this.delimiter + resolvedValues[i]; + resolvedValues.splice(i, 1); } else { - i++; + i += 1; } } - super('', listOfValues); - this.listOfValues = listOfValues; - } -} + return this._resolvedValues = resolvedValues; -/** - * Return whether the given object represents a CloudFormation intrinsic that is the result of a FnConcat resolution - */ -function isConcatIntrinsic(x: any) { - return isIntrinsic(x) && Object.keys(x)[0] === 'Fn::Join' && x['Fn::Join'][0] === ''; + function isFnJoinIntrinsicWithSameDelimiter(this: FnJoin, obj: any): boolean { + return isIntrinsic(obj) + && Object.keys(obj)[0] === 'Fn::Join' + && obj['Fn::Join'][0] === this.delimiter; + } + + function isPlainString(obj: any): boolean { + return typeof obj === 'string' && !unresolved(obj); + } + } } /** - * Return the concatted values of the concat intrinsic + * Alias for ``FnJoin('', listOfValues)``. */ -function concatIntrinsicValues(x: any) { - return x['Fn::Join'][1]; +export class FnConcat extends FnJoin { + /** + * Creates an ``Fn::Join`` function with an empty delimiter. + * @param listOfValues The list of values to concatenate. + */ + constructor(...listOfValues: any[]) { + super('', listOfValues); + } } /** diff --git a/packages/@aws-cdk/cdk/lib/core/tokens.ts b/packages/@aws-cdk/cdk/lib/core/tokens.ts index ebdbb5f671e09..31b0faac6bf33 100644 --- a/packages/@aws-cdk/cdk/lib/core/tokens.ts +++ b/packages/@aws-cdk/cdk/lib/core/tokens.ts @@ -106,7 +106,7 @@ export class Token { * that includes token markers). * @param obj The object to test. */ -export function unresolved(obj: any): obj is Token { +export function unresolved(obj: any): boolean { if (typeof(obj) === 'string') { return TOKEN_STRING_MAP.createTokenString(obj).test(); } else { diff --git a/packages/@aws-cdk/cdk/package-lock.json b/packages/@aws-cdk/cdk/package-lock.json index 143432e7f8fa8..c1a70b7ca03d0 100644 --- a/packages/@aws-cdk/cdk/package-lock.json +++ b/packages/@aws-cdk/cdk/package-lock.json @@ -10,6 +10,12 @@ "integrity": "sha512-4RKbhIDGC87s4EBy2Cp2/5S2O6kmCRcZnD5KRCq1q9z2GhBte1+BdsfVKCpG8yKpDGNyEE2G6IqFIh6W2YwWPA==", "dev": true }, + "@types/lodash": { + "version": "4.14.117", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.117.tgz", + "integrity": "sha512-xyf2m6tRbz8qQKcxYZa7PA4SllYcay+eh25DN3jmNYY6gSTL7Htc/bttVdkqj2wfJGbeWlQiX8pIyJpKU+tubw==", + "dev": true + }, "cli-color": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-0.1.7.tgz", @@ -39,6 +45,16 @@ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.8.2.tgz", "integrity": "sha1-q6jZ4ZQ6iVrJaDemKjmz9V7NlKs=" }, + "fast-check": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-1.7.0.tgz", + "integrity": "sha512-DsGnm75jR3yzG/yixA8HL9wvg6Z3ITTZgonKmS/yFCG+9XKXxW3dPafQNuxrggdw1MnGEo5IL0FyzFt0bWwkWA==", + "dev": true, + "requires": { + "lorem-ipsum": "~1.0.6", + "pure-rand": "^1.5.0" + } + }, "heap": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/heap/-/heap-0.2.6.tgz", @@ -59,6 +75,33 @@ "dreamopt": "~0.6.0" } }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "lorem-ipsum": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/lorem-ipsum/-/lorem-ipsum-1.0.6.tgz", + "integrity": "sha512-Rx4XH8X4KSDCKAVvWGYlhAfNqdUP5ZdT4rRyf0jjrvWgtViZimDIlopWNfn/y3lGM5K4uuiAoY28TaD+7YKFrQ==", + "dev": true, + "requires": { + "minimist": "~1.2.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "pure-rand": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-1.5.0.tgz", + "integrity": "sha512-acykcCwcBmt5l4w/lPxPUxMeYLb6qwsve3v9A44SNckwOyuXxZgTfP5qAsH/CyZSGkHdUnOQGmckOExOldivOw==", + "dev": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/packages/@aws-cdk/cdk/package.json b/packages/@aws-cdk/cdk/package.json index 9456295b440ae..f3ea11229f66f 100644 --- a/packages/@aws-cdk/cdk/package.json +++ b/packages/@aws-cdk/cdk/package.json @@ -53,8 +53,11 @@ "license": "Apache-2.0", "devDependencies": { "@types/js-base64": "^2.3.1", + "@types/lodash": "^4.14.117", "cdk-build-tools": "^0.13.0", "cfn2ts": "^0.13.0", + "fast-check": "^1.7.0", + "lodash": "^4.17.11", "pkglint": "^0.13.0" }, "dependencies": { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts index c8879d5a119c9..3584d20d39766 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { ArnComponents, ArnUtils, resolve, Token } from '../../lib'; +import { ArnComponents, ArnUtils, FnConcat, resolve, Token } from '../../lib'; export = { 'create from components with defaults'(test: Test) { @@ -8,19 +8,18 @@ export = { resource: 'myqueuename' }); - test.deepEqual(resolve(arn), { 'Fn::Join': - [ '', - [ 'arn', - ':', - { Ref: 'AWS::Partition' }, - ':', - 'sqs', - ':', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - 'myqueuename' ] ] }); + test.deepEqual(resolve(arn), + resolve(new FnConcat('arn', + ':', + { Ref: 'AWS::Partition' }, + ':', + 'sqs', + ':', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + 'myqueuename'))); test.done(); }, @@ -34,21 +33,20 @@ export = { resourceName: 'mytable/stream/label' }); - test.deepEqual(resolve(arn), { 'Fn::Join': - [ '', - [ 'arn', - ':', - 'aws-cn', - ':', - 'dynamodb', - ':', - 'us-east-1', - ':', - '123456789012', - ':', - 'table', - '/', - 'mytable/stream/label' ] ] }); + test.deepEqual(resolve(arn), + resolve(new FnConcat('arn', + ':', + 'aws-cn', + ':', + 'dynamodb', + ':', + 'us-east-1', + ':', + '123456789012', + ':', + 'table', + '/', + 'mytable/stream/label'))); test.done(); }, @@ -61,24 +59,18 @@ export = { partition: 'aws-cn', }); - test.deepEqual(resolve(arn), { - 'Fn::Join': [ - '', - [ - 'arn', - ':', - 'aws-cn', - ':', - 's3', - ':', - '', - ':', - '', - ':', - 'my-bucket', - ] - ] - }); + test.deepEqual(resolve(arn), + resolve(new FnConcat('arn', + ':', + 'aws-cn', + ':', + 's3', + ':', + '', + ':', + '', + ':', + 'my-bucket'))); test.done(); }, @@ -91,21 +83,20 @@ export = { resourceName: 'WordPress_App' }); - test.deepEqual(resolve(arn), { 'Fn::Join': - [ '', - [ 'arn', - ':', - { Ref: 'AWS::Partition' }, - ':', - 'codedeploy', - ':', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - 'application', - ':', - 'WordPress_App' ] ] }); + test.deepEqual(resolve(arn), + resolve(new FnConcat('arn', + ':', + { Ref: 'AWS::Partition' }, + ':', + 'codedeploy', + ':', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + 'application', + ':', + 'WordPress_App'))); test.done(); }, diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts index 87a0548d62a40..509834e7f2e72 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts @@ -1,11 +1,96 @@ +import fc = require('fast-check'); +import _ = require('lodash'); import nodeunit = require('nodeunit'); import fn = require('../../lib/cloudformation/fn'); +import { resolve } from '../../lib/core/tokens'; + +function asyncTest(cb: (test: nodeunit.Test) => Promise): (test: nodeunit.Test) => void { + return async (test: nodeunit.Test) => { + let error: Error; + try { + await cb(test); + } catch (e) { + error = e; + } finally { + test.doesNotThrow(() => { + if (error) { throw error; } + }); + test.done(); + } + }; +} + +const nonEmptyString = fc.string(1, 16); +const tokenish = fc.array(nonEmptyString, 2, 2).map(arr => ({ [arr[0]]: arr[1] })); +const anyValue = fc.oneof(nonEmptyString, tokenish); export = nodeunit.testCase({ - 'Fn::Join': { + FnJoin: { 'rejects empty list of arguments to join'(test: nodeunit.Test) { test.throws(() => new fn.FnJoin('.', [])); test.done(); - } - } + }, + 'resolves to the value if only one value is joined': asyncTest(async () => { + await fc.assert( + fc.property( + fc.string(), anyValue, + (delimiter, value) => _.isEqual(resolve(new fn.FnJoin(delimiter, [value])), value) + ), + { verbose: true } + ); + }), + 'pre-concatenates string literals': asyncTest(async () => { + await fc.assert( + fc.property( + fc.string(), fc.array(nonEmptyString, 1, 15), + (delimiter, values) => resolve(new fn.FnJoin(delimiter, values)) === values.join(delimiter) + ), + { verbose: true } + ); + }), + 'pre-concatenates around tokens': asyncTest(async () => { + await fc.assert( + fc.property( + fc.string(), fc.array(nonEmptyString, 1, 3), tokenish, fc.array(nonEmptyString, 1, 3), + (delimiter, prefix, obj, suffix) => + _.isEqual(resolve(new fn.FnJoin(delimiter, [...prefix, obj, ...suffix])), + { 'Fn::Join': [delimiter, [prefix.join(delimiter), obj, suffix.join(delimiter)]] }) + ), + { verbose: true, seed: 1539874645005, path: "0:0:0:0:0:0:0:0:0" } + ); + }), + 'flattens joins nested under joins with same delimiter': asyncTest(async () => { + await fc.assert( + fc.property( + fc.string(), fc.array(anyValue), + fc.array(anyValue, 1, 3), + fc.array(anyValue), + (delimiter, prefix, nested, suffix) => + // Gonna test + _.isEqual(resolve(new fn.FnJoin(delimiter, [...prefix, new fn.FnJoin(delimiter, nested), ...suffix])), + resolve(new fn.FnJoin(delimiter, [...prefix, ...nested, ...suffix]))) + ), + { verbose: true } + ); + }), + 'does not flatten joins nested under joins with different delimiter': asyncTest(async () => { + await fc.assert( + fc.property( + fc.string(), fc.string(), + fc.array(anyValue, 1, 3), + fc.array(tokenish, 2, 3), + fc.array(anyValue, 3), + (delimiter1, delimiter2, prefix, nested, suffix) => { + fc.pre(delimiter1 !== delimiter2); + const join = new fn.FnJoin(delimiter1, [...prefix, new fn.FnJoin(delimiter2, nested), ...suffix]); + const resolved = resolve(join); + return resolved['Fn::Join'][1].find((e: any) => typeof e === 'object' + && ('Fn::Join' in e) + && e['Fn::Join'][0] === delimiter2) != null; + } + ), + { verbose: true } + ); + }), + }, }); diff --git a/packages/@aws-cdk/cdk/test/core/test.tokens.ts b/packages/@aws-cdk/cdk/test/core/test.tokens.ts index 4aece581c20f3..4d17c2ae6f9f5 100644 --- a/packages/@aws-cdk/cdk/test/core/test.tokens.ts +++ b/packages/@aws-cdk/cdk/test/core/test.tokens.ts @@ -159,7 +159,7 @@ export = { 'Tokens stringification and reversing of CloudFormation Tokens is implemented using Fn::Join'(test: Test) { // GIVEN - const token = new CloudFormationToken(() => 'woof woof'); + const token = new CloudFormationToken(() => ({ woof: 'woof' })); // WHEN const stringified = `The dog says: ${token}`; @@ -167,7 +167,7 @@ export = { // THEN test.deepEqual(resolved, { - 'Fn::Join': ['', ['The dog says: ', 'woof woof']] + 'Fn::Join': ['', ['The dog says: ', { woof: 'woof' }]] }); test.done(); }, diff --git a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json b/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json index 8d13b76a7ad9e..850eb3247efed 100644 --- a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json +++ b/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json @@ -23,21 +23,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "iam", - ":", - "", - ":", - "aws", - ":", - "policy", - "/", - "service-role/AWSLambdaBasicExecutionRole" + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ] ] } @@ -60,14 +50,11 @@ "Fn::Join": [ "", [ - "arn", - ":", + "arn:", { "Ref": "AWS::Partition" }, - ":", - "ssm", - ":", + ":ssm:", { "Ref": "AWS::Region" }, @@ -75,21 +62,11 @@ { "Ref": "AWS::AccountId" }, - ":", - "parameter", - "/", + ":parameter//rtv/", { - "Fn::Join": [ - "", - [ - "/rtv/", - { - "Ref": "AWS::StackName" - }, - "/com.myorg/MyQueueURL" - ] - ] - } + "Ref": "AWS::StackName" + }, + "/com.myorg/MyQueueURL" ] ] } @@ -154,4 +131,4 @@ } } } -} \ No newline at end of file +}