diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/CF2RuntimeDefaultTestDeployAssertB25F4037.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/CF2RuntimeDefaultTestDeployAssertB25F4037.assets.json index 7b81b6fbbc089..52bf1e5df20a8 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/CF2RuntimeDefaultTestDeployAssertB25F4037.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/CF2RuntimeDefaultTestDeployAssertB25F4037.assets.json @@ -1,5 +1,5 @@ { - "version": "35.0.0", + "version": "36.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/cdk.out index c5cb2e5de6344..1f0068d32659a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"35.0.0"} \ No newline at end of file +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.assets.json index eaec73d98c45d..4f6d4c6f7b7c1 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.assets.json @@ -1,7 +1,7 @@ { - "version": "35.0.0", + "version": "36.0.0", "files": { - "5289568fbbfd952fddb41b828b4b0a8e4b54ec5892e158efd72cf494c0327e01": { + "f593b032ca2360f7f5beecafd32ec38ebe7a6cb5c25290e00d0066ebb69be3a2": { "source": { "path": "integ-distribution-function.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-eu-west-1": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1", - "objectKey": "5289568fbbfd952fddb41b828b4b0a8e4b54ec5892e158efd72cf494c0327e01.json", + "objectKey": "f593b032ca2360f7f5beecafd32ec38ebe7a6cb5c25290e00d0066ebb69be3a2.json", "region": "eu-west-1", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-eu-west-1" } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.template.json index 1ea7e8f64f1fa..27290243856b4 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ-distribution-function.template.json @@ -6,10 +6,10 @@ "AutoPublish": true, "FunctionCode": "function handler(event) { return event.request }", "FunctionConfig": { - "Comment": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB", + "Comment": "eu-west-1integ-distributinFunctionRequest8E65DEEB", "Runtime": "cloudfront-js-1.0" }, - "Name": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB" + "Name": "eu-west-1integ-distributinFunctionRequest8E65DEEB" } }, "FunctionResponse4EF2D1D3": { @@ -18,10 +18,10 @@ "AutoPublish": true, "FunctionCode": "function handler(event) { return event.response }", "FunctionConfig": { - "Comment": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1", + "Comment": "eu-west-1integ-distributiFunctionResponseDD4BADA1", "Runtime": "cloudfront-js-2.0" }, - "Name": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1" + "Name": "eu-west-1integ-distributiFunctionResponseDD4BADA1" } }, "DistB3B78991": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ.json index 3f83a1ff45115..0d701e61e53a2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "35.0.0", + "version": "36.0.0", "testCases": { "CF2Runtime/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/manifest.json index a71b2eef33f91..59a615053acc1 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "35.0.0", + "version": "36.0.0", "artifacts": { "integ-distribution-function.assets": { "type": "cdk:asset-manifest", @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-eu-west-1", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-eu-west-1", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1/5289568fbbfd952fddb41b828b4b0a8e4b54ec5892e158efd72cf494c0327e01.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1/f593b032ca2360f7f5beecafd32ec38ebe7a6cb5c25290e00d0066ebb69be3a2.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/tree.json index 47bb430289c3b..c96bc88fb7f51 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function-runtime.js.snapshot/tree.json @@ -21,10 +21,10 @@ "autoPublish": true, "functionCode": "function handler(event) { return event.request }", "functionConfig": { - "comment": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB", + "comment": "eu-west-1integ-distributinFunctionRequest8E65DEEB", "runtime": "cloudfront-js-1.0" }, - "name": "eu-west-1integdistributionfunctionFunctionRequest8E65DEEB" + "name": "eu-west-1integ-distributinFunctionRequest8E65DEEB" } }, "constructInfo": { @@ -51,10 +51,10 @@ "autoPublish": true, "functionCode": "function handler(event) { return event.response }", "functionConfig": { - "comment": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1", + "comment": "eu-west-1integ-distributiFunctionResponseDD4BADA1", "runtime": "cloudfront-js-2.0" }, - "name": "eu-west-1integdistributionfunctionFunctionResponseDD4BADA1" + "name": "eu-west-1integ-distributiFunctionResponseDD4BADA1" } }, "constructInfo": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/DistributionFunctionDefaultTestDeployAssert9D427BC1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/DistributionFunctionDefaultTestDeployAssert9D427BC1.assets.json new file mode 100644 index 0000000000000..cc09fc7467d09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/DistributionFunctionDefaultTestDeployAssert9D427BC1.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "DistributionFunctionDefaultTestDeployAssert9D427BC1.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/DistributionFunctionDefaultTestDeployAssert9D427BC1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/DistributionFunctionDefaultTestDeployAssert9D427BC1.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/DistributionFunctionDefaultTestDeployAssert9D427BC1.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out index 588d7b269d34f..1f0068d32659a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json index babf14841078f..7a38a75b120a0 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json @@ -1,7 +1,7 @@ { - "version": "20.0.0", + "version": "36.0.0", "files": { - "a2dbccbaab764e688387838f48ce3eda5041ff222bc5a0f576898a02fbe12fcf": { + "63f7f5881d7bc5ce53462b42e6c05e558d335432add6b977c8d03e31d2129fa3": { "source": { "path": "integ-distribution-function.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-eu-west-1": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1", - "objectKey": "a2dbccbaab764e688387838f48ce3eda5041ff222bc5a0f576898a02fbe12fcf.json", + "objectKey": "63f7f5881d7bc5ce53462b42e6c05e558d335432add6b977c8d03e31d2129fa3.json", "region": "eu-west-1", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-eu-west-1" } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json index c3047cb8d5ddc..a0f2c3d71b793 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json @@ -3,13 +3,13 @@ "Function76856677": { "Type": "AWS::CloudFront::Function", "Properties": { - "Name": "eu-west-1integdistributionfunctionFunctionDCD62A02", "AutoPublish": true, "FunctionCode": "function handler(event) { return event.request }", "FunctionConfig": { "Comment": "eu-west-1integdistributionfunctionFunctionDCD62A02", "Runtime": "cloudfront-js-1.0" - } + }, + "Name": "eu-west-1integdistributionfunctionFunctionDCD62A02" } }, "DistB3B78991": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json index 377b27136d433..6fd5eae8f7765 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json @@ -1,14 +1,12 @@ { - "version": "20.0.0", + "version": "36.0.0", "testCases": { - "integ.distribution-function": { + "DistributionFunction/DefaultTest": { "stacks": [ "integ-distribution-function" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "DistributionFunction/DefaultTest/DeployAssert", + "assertionStackName": "DistributionFunctionDefaultTestDeployAssert9D427BC1" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json index 7c0bda35357cb..93dabc383879f 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { - "version": "20.0.0", + "version": "36.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "integ-distribution-function.assets": { "type": "cdk:asset-manifest", "properties": { @@ -20,10 +14,11 @@ "environment": "aws://unknown-account/eu-west-1", "properties": { "templateFile": "integ-distribution-function.template.json", + "terminationProtection": false, "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-eu-west-1", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-eu-west-1", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1/a2dbccbaab764e688387838f48ce3eda5041ff222bc5a0f576898a02fbe12fcf.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1/63f7f5881d7bc5ce53462b42e6c05e558d335432add6b977c8d03e31d2129fa3.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -77,6 +72,60 @@ ] }, "displayName": "integ-distribution-function" + }, + "DistributionFunctionDefaultTestDeployAssert9D427BC1.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "DistributionFunctionDefaultTestDeployAssert9D427BC1.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "DistributionFunctionDefaultTestDeployAssert9D427BC1": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "DistributionFunctionDefaultTestDeployAssert9D427BC1.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "DistributionFunctionDefaultTestDeployAssert9D427BC1.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "DistributionFunctionDefaultTestDeployAssert9D427BC1.assets" + ], + "metadata": { + "/DistributionFunction/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/DistributionFunction/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "DistributionFunction/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json index 3d01793c6d29d..33a20a46337cf 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json @@ -4,14 +4,6 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" - } - }, "integ-distribution-function": { "id": "integ-distribution-function", "path": "integ-distribution-function", @@ -26,23 +18,23 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::CloudFront::Function", "aws:cdk:cloudformation:props": { - "name": "eu-west-1integdistributionfunctionFunctionDCD62A02", "autoPublish": true, "functionCode": "function handler(event) { return event.request }", "functionConfig": { "comment": "eu-west-1integdistributionfunctionFunctionDCD62A02", "runtime": "cloudfront-js-1.0" - } + }, + "name": "eu-west-1integdistributionfunctionFunctionDCD62A02" } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudfront.CfnFunction", + "fqn": "aws-cdk-lib.aws_cloudfront.CfnFunction", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudfront.Function", + "fqn": "aws-cdk-lib.aws_cloudfront.Function", "version": "0.0.0" } }, @@ -55,7 +47,7 @@ "path": "integ-distribution-function/Dist/Origin1", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.3.0" } }, "Resource": { @@ -99,13 +91,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudfront.CfnDistribution", + "fqn": "aws-cdk-lib.aws_cloudfront.CfnDistribution", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudfront.Distribution", + "fqn": "aws-cdk-lib.aws_cloudfront.Distribution", "version": "0.0.0" } }, @@ -113,28 +105,106 @@ "id": "FunctionArn", "path": "integ-distribution-function/FunctionArn", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" } }, "FunctionStage": { "id": "FunctionStage", "path": "integ-distribution-function/FunctionStage", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-distribution-function/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-distribution-function/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "DistributionFunction": { + "id": "DistributionFunction", + "path": "DistributionFunction", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "DistributionFunction/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "DistributionFunction/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "DistributionFunction/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "DistributionFunction/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "DistributionFunction/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts index cf56ff5e90be8..98148cec89d07 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts @@ -1,6 +1,7 @@ import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-function', { env: { region: 'eu-west-1' } }); @@ -23,4 +24,8 @@ new cloudfront.Distribution(stack, 'Dist', { new cdk.CfnOutput(stack, 'FunctionArn', { value: cfFunction.functionArn }); new cdk.CfnOutput(stack, 'FunctionStage', { value: cfFunction.functionStage }); +new IntegTest(app, 'DistributionFunction', { + testCases: [stack], +}); + app.synth(); diff --git a/packages/@aws-cdk/aws-apprunner-alpha/README.md b/packages/@aws-cdk/aws-apprunner-alpha/README.md index 22c95ccdf2b23..845a1eb34c447 100644 --- a/packages/@aws-cdk/aws-apprunner-alpha/README.md +++ b/packages/@aws-cdk/aws-apprunner-alpha/README.md @@ -180,6 +180,26 @@ new apprunner.Service(this, 'Service', { }); ``` +## Dual Stack + +To use dual stack (IPv4 and IPv6) for your incoming public network configuration, set `ipAddressType` to `IpAddressType.DUAL_STACK`. + +```ts +new apprunner.Service(this, 'Service', { + source: apprunner.Source.fromEcrPublic({ + imageConfiguration: { port: 8000 }, + imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest', + }), + ipAddressType: apprunner.IpAddressType.DUAL_STACK, +}); +``` + +**Note**: Currently, App Runner supports dual stack for only Public endpoint. +Only IPv4 is supported for Private endpoint. +If you update a service that's using dual-stack Public endpoint to a Private endpoint, +your App Runner service will default to support only IPv4 for Private endpoint and fail +to receive traffic originating from IPv6 endpoint. + ## Secrets Manager To include environment variables integrated with AWS Secrets Manager, use the `environmentSecrets` attribute. diff --git a/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts b/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts index c66fb75d850bf..412372e18bb90 100644 --- a/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts +++ b/packages/@aws-cdk/aws-apprunner-alpha/lib/service.ts @@ -723,6 +723,13 @@ export interface ServiceProps { * @default - Use an AWS managed key */ readonly kmsKey?: kms.IKey; + + /** + * The IP address type for your incoming public network configuration. + * + * @default - IpAddressType.IPV4 + */ + readonly ipAddressType?: IpAddressType; } /** @@ -1004,6 +1011,21 @@ export class HealthCheck { } } +/** + * The IP address type for your incoming public network configuration. + */ +export enum IpAddressType { + /** + * IPV4 + */ + IPV4 = 'IPV4', + + /** + * DUAL_STACK + */ + DUAL_STACK = 'DUAL_STACK', +} + /** * Attributes for the App Runner Service */ @@ -1255,6 +1277,7 @@ export class Service extends cdk.Resource implements iam.IGrantable { egressType: this.props.vpcConnector ? 'VPC' : 'DEFAULT', vpcConnectorArn: this.props.vpcConnector?.vpcConnectorArn, }, + ipAddressType: this.props.ipAddressType, }, healthCheckConfiguration: this.props.healthCheck ? this.props.healthCheck.bind() : diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets.json new file mode 100644 index 0000000000000..c1ed20a783b61 --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.template.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/cdk.out b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ-apprunner-ip-address-type.assets.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ-apprunner-ip-address-type.assets.json new file mode 100644 index 0000000000000..3edc2aa75e54b --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ-apprunner-ip-address-type.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "f9e956fb5e2f791153ea7f9505e67fce8b218eac61d16971b414879ba0b5e11d": { + "source": { + "path": "integ-apprunner-ip-address-type.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "f9e956fb5e2f791153ea7f9505e67fce8b218eac61d16971b414879ba0b5e11d.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ-apprunner-ip-address-type.template.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ-apprunner-ip-address-type.template.json new file mode 100644 index 0000000000000..03051f42579aa --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ-apprunner-ip-address-type.template.json @@ -0,0 +1,104 @@ +{ + "Resources": { + "ServiceInstanceRoleDFA90CEC": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "tasks.apprunner.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "ServiceDBC79909": { + "Type": "AWS::AppRunner::Service", + "Properties": { + "InstanceConfiguration": { + "InstanceRoleArn": { + "Fn::GetAtt": [ + "ServiceInstanceRoleDFA90CEC", + "Arn" + ] + } + }, + "NetworkConfiguration": { + "EgressConfiguration": { + "EgressType": "DEFAULT" + }, + "IpAddressType": "DUAL_STACK" + }, + "ServiceName": "service", + "SourceConfiguration": { + "AuthenticationConfiguration": {}, + "AutoDeploymentsEnabled": false, + "ImageRepository": { + "ImageConfiguration": { + "Port": "8000" + }, + "ImageIdentifier": "public.ecr.aws/aws-containers/hello-app-runner:latest", + "ImageRepositoryType": "ECR_PUBLIC" + } + } + } + } + }, + "Outputs": { + "URL": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Fn::GetAtt": [ + "ServiceDBC79909", + "ServiceUrl" + ] + } + ] + ] + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ.json new file mode 100644 index 0000000000000..40c51edee8188 --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "AppRunnerIpAddressType/DefaultTest": { + "stacks": [ + "integ-apprunner-ip-address-type" + ], + "assertionStack": "AppRunnerIpAddressType/DefaultTest/DeployAssert", + "assertionStackName": "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/manifest.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/manifest.json new file mode 100644 index 0000000000000..1f50a8f75aebc --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/manifest.json @@ -0,0 +1,125 @@ +{ + "version": "36.0.0", + "artifacts": { + "integ-apprunner-ip-address-type.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-apprunner-ip-address-type.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-apprunner-ip-address-type": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-apprunner-ip-address-type.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/f9e956fb5e2f791153ea7f9505e67fce8b218eac61d16971b414879ba0b5e11d.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-apprunner-ip-address-type.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integ-apprunner-ip-address-type.assets" + ], + "metadata": { + "/integ-apprunner-ip-address-type/Service/InstanceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ServiceInstanceRoleDFA90CEC" + } + ], + "/integ-apprunner-ip-address-type/Service/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ServiceDBC79909" + } + ], + "/integ-apprunner-ip-address-type/URL": [ + { + "type": "aws:cdk:logicalId", + "data": "URL" + } + ], + "/integ-apprunner-ip-address-type/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-apprunner-ip-address-type/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-apprunner-ip-address-type" + }, + "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "AppRunnerIpAddressTypeDefaultTestDeployAssertAC7DD6FC.assets" + ], + "metadata": { + "/AppRunnerIpAddressType/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/AppRunnerIpAddressType/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "AppRunnerIpAddressType/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/tree.json b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/tree.json new file mode 100644 index 0000000000000..06ea3cb77a255 --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.js.snapshot/tree.json @@ -0,0 +1,201 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-apprunner-ip-address-type": { + "id": "integ-apprunner-ip-address-type", + "path": "integ-apprunner-ip-address-type", + "children": { + "Service": { + "id": "Service", + "path": "integ-apprunner-ip-address-type/Service", + "children": { + "InstanceRole": { + "id": "InstanceRole", + "path": "integ-apprunner-ip-address-type/Service/InstanceRole", + "children": { + "ImportInstanceRole": { + "id": "ImportInstanceRole", + "path": "integ-apprunner-ip-address-type/Service/InstanceRole/ImportInstanceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-apprunner-ip-address-type/Service/InstanceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "tasks.apprunner.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-apprunner-ip-address-type/Service/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppRunner::Service", + "aws:cdk:cloudformation:props": { + "instanceConfiguration": { + "instanceRoleArn": { + "Fn::GetAtt": [ + "ServiceInstanceRoleDFA90CEC", + "Arn" + ] + } + }, + "networkConfiguration": { + "egressConfiguration": { + "egressType": "DEFAULT" + }, + "ipAddressType": "DUAL_STACK" + }, + "serviceName": "service", + "sourceConfiguration": { + "authenticationConfiguration": {}, + "autoDeploymentsEnabled": false, + "imageRepository": { + "imageConfiguration": { + "port": "8000" + }, + "imageIdentifier": "public.ecr.aws/aws-containers/hello-app-runner:latest", + "imageRepositoryType": "ECR_PUBLIC" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apprunner.CfnService", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "URL": { + "id": "URL", + "path": "integ-apprunner-ip-address-type/URL", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-apprunner-ip-address-type/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-apprunner-ip-address-type/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "AppRunnerIpAddressType": { + "id": "AppRunnerIpAddressType", + "path": "AppRunnerIpAddressType", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "AppRunnerIpAddressType/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "AppRunnerIpAddressType/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "AppRunnerIpAddressType/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "AppRunnerIpAddressType/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "AppRunnerIpAddressType/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.ts b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.ts new file mode 100644 index 0000000000000..d1b9194f0f3cd --- /dev/null +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/integ.service-ip-address-type.ts @@ -0,0 +1,27 @@ +import * as cdk from 'aws-cdk-lib'; +import { IpAddressType, Service, Source } from '../lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'integ-apprunner-ip-address-type'); + +const service = new Service(stack, 'Service', { + serviceName: 'service', + source: Source.fromEcrPublic({ + imageConfiguration: { + port: 8000, + }, + imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest', + }), + autoDeploymentsEnabled: false, + ipAddressType: IpAddressType.DUAL_STACK, +}); + +new cdk.CfnOutput(stack, 'URL', { value: `https://${service.serviceUrl}` }); + +new integ.IntegTest(app, 'AppRunnerIpAddressType', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apprunner-alpha/test/service.test.ts b/packages/@aws-cdk/aws-apprunner-alpha/test/service.test.ts index 389c36de9c7b5..6843cd13a3bc5 100644 --- a/packages/@aws-cdk/aws-apprunner-alpha/test/service.test.ts +++ b/packages/@aws-cdk/aws-apprunner-alpha/test/service.test.ts @@ -1604,4 +1604,26 @@ test('create a service with a customer managed key)', () => { KmsKey: stack.resolve(key.keyArn), }, }); -}); \ No newline at end of file +}); + +test.each([apprunner.IpAddressType.IPV4, apprunner.IpAddressType.DUAL_STACK])('ipAddressType is set %s', (ipAddressType: apprunner.IpAddressType) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'demo-stack'); + + // WHEN + new apprunner.Service(stack, 'DemoService', { + source: apprunner.Source.fromEcrPublic({ + imageConfiguration: { port: 8000 }, + imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest', + }), + ipAddressType, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AppRunner::Service', { + NetworkConfiguration: { + IpAddressType: ipAddressType, + }, + }); +}); diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts index e14a1f53c5cf7..666802dd8e232 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import { Construct } from 'constructs'; import { CfnFunction } from './cloudfront.generated'; import { IKeyValueStore } from './key-value-store'; -import { IResource, Names, Resource, Stack } from '../../core'; +import { IResource, Lazy, Names, Resource, Stack } from '../../core'; /** * Represents the function's source code @@ -222,11 +222,17 @@ export class Function extends Resource implements IFunction { } private generateName(): string { - const name = Stack.of(this).region + Names.uniqueId(this); - if (name.length > 64) { - return name.substring(0, 32) + name.substring(name.length - 32); + /** + * Since token string can be single- or double-digit region name, it may + * lead to non-deterministic behaviour. + */ + const idLength = 64 - '${Token[AWS.Region.00]}'.length; + if (Names.uniqueId(this).length <= idLength) { + return Stack.of(this).region + Names.uniqueId(this); } - return name; + return Stack.of(this).region + Lazy.string({ + produce: () => Names.uniqueResourceName(this, { maxLength: 40, allowedSpecialCharacters: '-_' }), + }); } } diff --git a/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts index 38072b8614bd2..903527dfaaf7e 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts @@ -204,6 +204,29 @@ describe('CloudFront Function', () => { }); }); + test('long name truncates correctly every time', () => { + const app = new App(); + const stack = new Stack(app, 'CdkTestWithALongNameStack'); + + new Function(stack, 'MyCloudFrontFunction', { + code: FunctionCode.fromInline(''), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', { + Name: { + 'Fn::Join': [ + '', + [ + { + Ref: 'AWS::Region', + }, + 'CdkTestWithALongoudFrontFunction302260D0', + ], + ], + }, + }); + }); + describe('key value store association', () => { test('minimal example', () => { const stack = new Stack(); diff --git a/packages/aws-cdk-lib/aws-codebuild/README.md b/packages/aws-cdk-lib/aws-codebuild/README.md index 85d681a9c8acf..3dde80fa45528 100644 --- a/packages/aws-cdk-lib/aws-codebuild/README.md +++ b/packages/aws-cdk-lib/aws-codebuild/README.md @@ -69,6 +69,9 @@ const gitHubSource = codebuild.Source.gitHub({ .inEventOf(codebuild.EventAction.PUSH) .andBranchIs('main') .andCommitMessageIs('the commit message'), + codebuild.FilterGroup + .inEventOf(codebuild.EventAction.RELEASED) + .andBranchIs('main') ], // optional, by default all pushes and Pull Requests will trigger a build }); ``` diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/source.ts b/packages/aws-cdk-lib/aws-codebuild/lib/source.ts index 42a231bdacd06..5e2250fdafe3e 100644 --- a/packages/aws-cdk-lib/aws-codebuild/lib/source.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/source.ts @@ -178,6 +178,11 @@ export enum EventAction { */ PULL_REQUEST_UPDATED = 'PULL_REQUEST_UPDATED', + /** + * Closing a Pull Request. + */ + PULL_REQUEST_CLOSED = 'PULL_REQUEST_CLOSED', + /** * Merging a Pull Request. */ @@ -188,6 +193,24 @@ export enum EventAction { * Note that this event is only supported for GitHub and GitHubEnterprise sources. */ PULL_REQUEST_REOPENED = 'PULL_REQUEST_REOPENED', + + /** + * A release is created in the repository. + * Works with GitHub only. + */ + RELEASED = 'RELEASED', + + /** + * A prerelease is created in the repository. + * Works with GitHub only. + */ + PRERELEASED = 'PRERELEASED', + + /** + * A workflow job is queued in the repository. + * Works with GitHub only. + */ + WORKFLOW_JOB_QUEUED = 'WORKFLOW_JOB_QUEUED', } enum WebhookFilterTypes { diff --git a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts index b9d2c4cb8de7c..3eb3ac3fe6894 100644 --- a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts @@ -567,6 +567,10 @@ describe('default properties', () => { webhookFilters: [ codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH).andTagIsNot('stable'), codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_REOPENED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.RELEASED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PRERELEASED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.WORKFLOW_JOB_QUEUED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_CLOSED).andBaseBranchIs('main'), ], }), }); @@ -595,6 +599,22 @@ describe('default properties', () => { { Type: 'EVENT', Pattern: 'PULL_REQUEST_REOPENED' }, { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, ], + [ + { Type: 'EVENT', Pattern: 'RELEASED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], + [ + { Type: 'EVENT', Pattern: 'PRERELEASED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], + [ + { Type: 'EVENT', Pattern: 'WORKFLOW_JOB_QUEUED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], + [ + { Type: 'EVENT', Pattern: 'PULL_REQUEST_CLOSED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], ], }, }); @@ -664,6 +684,7 @@ describe('default properties', () => { codebuild.EventAction.PULL_REQUEST_CREATED, codebuild.EventAction.PULL_REQUEST_UPDATED, codebuild.EventAction.PULL_REQUEST_MERGED, + codebuild.EventAction.PULL_REQUEST_CLOSED, ).andTagIs('v.*'), // duplicate event actions are fine codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PUSH).andActorAccountIsNot('aws-cdk-dev'), @@ -685,7 +706,7 @@ describe('default properties', () => { Webhook: true, FilterGroups: [ [ - { Type: 'EVENT', Pattern: 'PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_MERGED' }, + { Type: 'EVENT', Pattern: 'PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_MERGED, PULL_REQUEST_CLOSED' }, { Type: 'HEAD_REF', Pattern: 'refs/tags/v.*' }, ], [