diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index 9416b6c06ab70..fd0088fa79d2e 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.123.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.122.0-alpha.0...v2.123.0-alpha.0) (2024-01-24) + + +### Features + +* **iot-actions-alpha:** open search action in IoT topic rule ([#28748](https://github.com/aws/aws-cdk/issues/28748)) ([84b23cb](https://github.com/aws/aws-cdk/commit/84b23cb07d421ec004e412bf48e837ae0d87f7fe)) + + +### Bug Fixes + +* **amplify:** addBranch fails synth with "cannot find entry file..." ([#28772](https://github.com/aws/aws-cdk/issues/28772)) ([cb522bb](https://github.com/aws/aws-cdk/commit/cb522bb65b03e9b0cdcbd01b4f71798e628424f4)), closes [#28658](https://github.com/aws/aws-cdk/issues/28658) [#28764](https://github.com/aws/aws-cdk/issues/28764) +* **redshift:** enableRebootForParameterChanges fails synth with "cannot find entry fileā€¦" ([#28760](https://github.com/aws/aws-cdk/issues/28760)) ([4952f36](https://github.com/aws/aws-cdk/commit/4952f36ff70c25c7a56676fedf47ab6571c19cea)) + ## [2.122.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.121.1-alpha.0...v2.122.0-alpha.0) (2024-01-18) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index eb148d49cbb23..deb194083f35e 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,34 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.123.0](https://github.com/aws/aws-cdk/compare/v2.122.0...v2.123.0) (2024-01-24) + + +### Features + +* **apigatewayv2:** AWS type websocket api integration in http api ([#28718](https://github.com/aws/aws-cdk/issues/28718)) ([4d7374e](https://github.com/aws/aws-cdk/commit/4d7374ea5b83c4341935f5e5b39429b662c3857d)), closes [/docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-integration.html#cfn-apigatewayv2](https://github.com/aws//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-integration.html/issues/cfn-apigatewayv2) +* **autoscaling:** `datapointsToAlarm` property for step scaling policy ([#28792](https://github.com/aws/aws-cdk/issues/28792)) ([baf2bfb](https://github.com/aws/aws-cdk/commit/baf2bfb18dda5d05d563a082b32b4fb13de321e0)), closes [#28749](https://github.com/aws/aws-cdk/issues/28749) +* **core:** add validations for export name in CfnOutput ([#28575](https://github.com/aws/aws-cdk/issues/28575)) ([513d9fb](https://github.com/aws/aws-cdk/commit/513d9fb57a896b9f6998d7157f01080cc87ad233)), closes [#28563](https://github.com/aws/aws-cdk/issues/28563) +* **core:** custom resources deprecate `logRetention` in favor of `logGroup` ([#28783](https://github.com/aws/aws-cdk/issues/28783)) ([ea34c89](https://github.com/aws/aws-cdk/commit/ea34c89d92d126c56bfffab6c17361cfaa00315f)), closes [#28737](https://github.com/aws/aws-cdk/issues/28737) +* **dynamodb:** import data from the bucket ([#28610](https://github.com/aws/aws-cdk/issues/28610)) ([45b8398](https://github.com/aws/aws-cdk/commit/45b8398bec9ba9c03f195c14f3b92188c9058a7b)), closes [#21825](https://github.com/aws/aws-cdk/issues/21825) +* **ec2:** flow logs from TransitGateway and TransitGatewayAttachment ([#28605](https://github.com/aws/aws-cdk/issues/28605)) ([a238590](https://github.com/aws/aws-cdk/commit/a2385907c73f6ebbda85919ca2138ef8471e707d)), closes [#27222](https://github.com/aws/aws-cdk/issues/27222) +* **ecs:** add neuron to ecs AMI hardware type ([#28819](https://github.com/aws/aws-cdk/issues/28819)) ([ef1d64e](https://github.com/aws/aws-cdk/commit/ef1d64ef7aaf30c68fa21d625e3b22cb66283d26)), closes [#28198](https://github.com/aws/aws-cdk/issues/28198) +* **ecs:** support for explicit activation of the circuit breaker ([#28611](https://github.com/aws/aws-cdk/issues/28611)) ([bbb9555](https://github.com/aws/aws-cdk/commit/bbb95550b84f2fa179ba05f2fcf738eb11a9c525)), closes [#27131](https://github.com/aws/aws-cdk/issues/27131) +* **ecs-patterns:** cooldown parameter to QueueProcessingServiceBaseProps ([#28730](https://github.com/aws/aws-cdk/issues/28730)) ([b3b672a](https://github.com/aws/aws-cdk/commit/b3b672af736d64c346508dde55d5a9df11f7009d)), closes [#8298](https://github.com/aws/aws-cdk/issues/8298) +* **logs:** support data protection custom data identifiers ([#28553](https://github.com/aws/aws-cdk/issues/28553)) ([1222aaa](https://github.com/aws/aws-cdk/commit/1222aaac57a48113a52347a99e41af59236c0aef)), closes [#28430](https://github.com/aws/aws-cdk/issues/28430) +* **rds:** allocatedStorage parameter for DatabaseInstanceReadReplica ([#28789](https://github.com/aws/aws-cdk/issues/28789)) ([df8fbc4](https://github.com/aws/aws-cdk/commit/df8fbc48c2eaf59c3380d3ffa46d0024ef88ada5)), closes [#17083](https://github.com/aws/aws-cdk/issues/17083) +* **rds:** Kerberos authentication support in Aurora Database Clusters ([#28559](https://github.com/aws/aws-cdk/issues/28559)) ([bdf4285](https://github.com/aws/aws-cdk/commit/bdf42854ba74b80d18263e77ec76ce1c2356fd38)), closes [/github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/instance.ts#L625](https://github.com/aws//github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/instance.ts/issues/L625) [/github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/instance.ts#L633](https://github.com/aws//github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/instance.ts/issues/L633) [#28050](https://github.com/aws/aws-cdk/issues/28050) +* **stepfunctions:** support Map ItemSelector ([#28771](https://github.com/aws/aws-cdk/issues/28771)) ([b226a8c](https://github.com/aws/aws-cdk/commit/b226a8ca50e41853d60958374dbac4addc20d861)), closes [#27913](https://github.com/aws/aws-cdk/issues/27913) [#23265](https://github.com/aws/aws-cdk/issues/23265) +* update L1 CloudFormation resource definitions ([#28811](https://github.com/aws/aws-cdk/issues/28811)) ([1b6be8b](https://github.com/aws/aws-cdk/commit/1b6be8b94b8620911cf8418f0627227045c47bf9)) + + +### Bug Fixes + +* **appsync:** add dependency to logretention for graphql apis log group ([#28548](https://github.com/aws/aws-cdk/issues/28548)) ([04e5480](https://github.com/aws/aws-cdk/commit/04e5480399c2ff3f3487583343fd3021a63b63e1)), closes [#26564](https://github.com/aws/aws-cdk/issues/26564) +* **CLI:** `cdk diff` is not clear enough about using read-only change sets ([#28741](https://github.com/aws/aws-cdk/issues/28741)) ([bb50f97](https://github.com/aws/aws-cdk/commit/bb50f97393cf54963b0c19a104d8a7b487963b83)) +* **lambda:** lambda does not set environment variables for `AWS_CODEGURU_PROFILER` properties when creating Amazon CodeGuruProfiler profiling group ([#28762](https://github.com/aws/aws-cdk/issues/28762)) ([2511956](https://github.com/aws/aws-cdk/commit/2511956fc619ffa2c55d7e2637e97d7359f96de3)), closes [#23511](https://github.com/aws/aws-cdk/issues/23511) +* **rds:** Failed to create a Database Instance with Kerberos authentication configured ([#28601](https://github.com/aws/aws-cdk/issues/28601)) ([b620f1b](https://github.com/aws/aws-cdk/commit/b620f1b65e9254f76d4ebfa7d77e0cb4ef91514f)), closes [#28600](https://github.com/aws/aws-cdk/issues/28600) + ## [2.122.0](https://github.com/aws/aws-cdk/compare/v2.121.1...v2.122.0) (2024-01-18) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.assets.json new file mode 100644 index 0000000000000..3720ef61a8e2c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.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.function-key-value-store-association.js.snapshot/FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.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.function-key-value-store-association.js.snapshot/asset.9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/asset.9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json new file mode 100644 index 0000000000000..c5999fd9d8723 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/asset.9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json @@ -0,0 +1,12 @@ +{ + "data":[ + { + "key":"key1", + "value":"value" + }, + { + "key":"key2", + "value":"value" + } + ] +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ-function-key-value-store-association.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ-function-key-value-store-association.assets.json new file mode 100644 index 0000000000000..78f78472e1e24 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ-function-key-value-store-association.assets.json @@ -0,0 +1,32 @@ +{ + "version": "36.0.0", + "files": { + "9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1": { + "source": { + "path": "asset.9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "5ab0a11edcee54ef5956720528876fb90b8a0b2b8e51c40c5bdca486bf681ba1": { + "source": { + "path": "integ-function-key-value-store-association.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5ab0a11edcee54ef5956720528876fb90b8a0b2b8e51c40c5bdca486bf681ba1.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.function-key-value-store-association.js.snapshot/integ-function-key-value-store-association.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ-function-key-value-store-association.template.json new file mode 100644 index 0000000000000..7c57353b9fefb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ-function-key-value-store-association.template.json @@ -0,0 +1,86 @@ +{ + "Resources": { + "TestKeyValueStore8D0C09A2": { + "Type": "AWS::CloudFront::KeyValueStore", + "Properties": { + "Comment": "A test Key Value Store for CloudFront", + "ImportSource": { + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json" + ] + ] + }, + "SourceType": "S3" + }, + "Name": "integfunctionkeyvaluestoreassociationTestKeyValueStoreA8304A36" + } + }, + "TestFunction22AD90FC": { + "Type": "AWS::CloudFront::Function", + "Properties": { + "AutoPublish": true, + "FunctionCode": "code", + "FunctionConfig": { + "Comment": "TestKvFunction", + "KeyValueStoreAssociations": [ + { + "KeyValueStoreARN": { + "Fn::GetAtt": [ + "TestKeyValueStore8D0C09A2", + "Arn" + ] + } + } + ], + "Runtime": "cloudfront-js-2.0" + }, + "Name": "TestKvFunction" + } + } + }, + "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.function-key-value-store-association.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ.json new file mode 100644 index 0000000000000..156ca2a1a40d2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "FunctionKeyValueStoreAssociation/DefaultTest": { + "stacks": [ + "integ-function-key-value-store-association" + ], + "assertionStack": "FunctionKeyValueStoreAssociation/DefaultTest/DeployAssert", + "assertionStackName": "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/manifest.json new file mode 100644 index 0000000000000..2a4dd6b9a9353 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/manifest.json @@ -0,0 +1,119 @@ +{ + "version": "36.0.0", + "artifacts": { + "integ-function-key-value-store-association.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-function-key-value-store-association.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-function-key-value-store-association": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-function-key-value-store-association.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}/5ab0a11edcee54ef5956720528876fb90b8a0b2b8e51c40c5bdca486bf681ba1.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-function-key-value-store-association.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-function-key-value-store-association.assets" + ], + "metadata": { + "/integ-function-key-value-store-association/TestKeyValueStore/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TestKeyValueStore8D0C09A2" + } + ], + "/integ-function-key-value-store-association/TestFunction/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TestFunction22AD90FC" + } + ], + "/integ-function-key-value-store-association/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-function-key-value-store-association/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-function-key-value-store-association" + }, + "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.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": [ + "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.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": [ + "FunctionKeyValueStoreAssociationDefaultTestDeployAssert986D766D.assets" + ], + "metadata": { + "/FunctionKeyValueStoreAssociation/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/FunctionKeyValueStoreAssociation/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "FunctionKeyValueStoreAssociation/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.function-key-value-store-association.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/tree.json new file mode 100644 index 0000000000000..dd3459c6f09c3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.js.snapshot/tree.json @@ -0,0 +1,211 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-function-key-value-store-association": { + "id": "integ-function-key-value-store-association", + "path": "integ-function-key-value-store-association", + "children": { + "TestKeyValueStore": { + "id": "TestKeyValueStore", + "path": "integ-function-key-value-store-association/TestKeyValueStore", + "children": { + "ImportSource": { + "id": "ImportSource", + "path": "integ-function-key-value-store-association/TestKeyValueStore/ImportSource", + "children": { + "Stage": { + "id": "Stage", + "path": "integ-function-key-value-store-association/TestKeyValueStore/ImportSource/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "integ-function-key-value-store-association/TestKeyValueStore/ImportSource/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-function-key-value-store-association/TestKeyValueStore/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudFront::KeyValueStore", + "aws:cdk:cloudformation:props": { + "comment": "A test Key Value Store for CloudFront", + "importSource": { + "sourceType": "S3", + "sourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/9c0f502203ec9d802046021b8a20affe8fd26234f67dcf2e93db5142bc2991a1.json" + ] + ] + } + }, + "name": "integfunctionkeyvaluestoreassociationTestKeyValueStoreA8304A36" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudfront.CfnKeyValueStore", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudfront.KeyValueStore", + "version": "0.0.0" + } + }, + "TestFunction": { + "id": "TestFunction", + "path": "integ-function-key-value-store-association/TestFunction", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-function-key-value-store-association/TestFunction/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudFront::Function", + "aws:cdk:cloudformation:props": { + "autoPublish": true, + "functionCode": "code", + "functionConfig": { + "comment": "TestKvFunction", + "runtime": "cloudfront-js-2.0", + "keyValueStoreAssociations": [ + { + "keyValueStoreArn": { + "Fn::GetAtt": [ + "TestKeyValueStore8D0C09A2", + "Arn" + ] + } + } + ] + }, + "name": "TestKvFunction" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudfront.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudfront.Function", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-function-key-value-store-association/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-function-key-value-store-association/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "FunctionKeyValueStoreAssociation": { + "id": "FunctionKeyValueStoreAssociation", + "path": "FunctionKeyValueStoreAssociation", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "FunctionKeyValueStoreAssociation/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "FunctionKeyValueStoreAssociation/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "FunctionKeyValueStoreAssociation/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "FunctionKeyValueStoreAssociation/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "FunctionKeyValueStoreAssociation/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-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.ts new file mode 100644 index 0000000000000..b11a3cc47c131 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.function-key-value-store-association.ts @@ -0,0 +1,23 @@ +import * as path from 'node:path'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-function-key-value-store-association'); + +const store = new cloudfront.KeyValueStore(stack, 'TestKeyValueStore', { + comment: 'A test Key Value Store for CloudFront', + source: cloudfront.ImportSource.fromAsset(path.join(__dirname, 'test-import-source.json')), +}); +new cloudfront.Function(stack, 'TestFunction', { + functionName: 'TestKvFunction', + code: cloudfront.FunctionCode.fromInline('code'), + keyValueStore: store, +}); + +new IntegTest(app, 'FunctionKeyValueStoreAssociation', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets.json new file mode 100644 index 0000000000000..edab5767ec4c1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "443cd498fca620868cfc5e66c6d03b3dcd2cc9d88b6eba24927a4e8d06ae7984": { + "source": { + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "443cd498fca620868cfc5e66c6d03b3dcd2cc9d88b6eba24927a4e8d06ae7984.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-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestStackWithFeatureFlag.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestStackWithFeatureFlag.template.json new file mode 100644 index 0000000000000..c2fe3bad39eb1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestStackWithFeatureFlag.template.json @@ -0,0 +1,355 @@ +{ + "Resources": { + "inAlarmLambdaFeatureServiceRoleA2CD21D1": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "inAlarmLambdaFeature6C78D351": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = function handler(event, _context, callback) {\n console.log(JSON.stringify(event, undefined, 2));\n return callback();\n}" + }, + "FunctionName": "inAlarmLambdaFeature", + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "inAlarmLambdaFeatureServiceRoleA2CD21D1", + "Arn" + ] + }, + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "inAlarmLambdaFeatureServiceRoleA2CD21D1" + ] + }, + "Alarm7103F465": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" + }, + { + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" + }, + { + "Fn::GetAtt": [ + "alarmLambdaFeatureD560800F", + "Arn" + ] + } + ], + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "inAlarmLambdaFeature6C78D351" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + } + }, + "alarmLambdaFeatureServiceRole853A864D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "alarmLambdaFeatureD560800F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = function handler(event, _context, callback) {\n console.log(JSON.stringify(event, undefined, 2));\n return callback();\n}" + }, + "FunctionName": "alarmLambdaFeature", + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "alarmLambdaFeatureServiceRole853A864D", + "Arn" + ] + }, + "Runtime": "nodejs18.x" + }, + "DependsOn": [ + "alarmLambdaFeatureServiceRole853A864D" + ] + }, + "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b": { + "Type": "AWS::Lambda::Version", + "Properties": { + "FunctionName": { + "Ref": "alarmLambdaFeatureD560800F" + } + } + }, + "alarmLambdaFeatureCurrentVersionAlarmAlarmPermissionA0D80E66": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" + }, + "Principal": "lambda.alarms.cloudwatch.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::GetAtt": [ + "Alarm7103F465", + "Arn" + ] + } + } + }, + "alarmLambdaFeatureCurrentVersionAlarmFeatureAlarmPermission192451B4": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" + }, + "Principal": "lambda.alarms.cloudwatch.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::GetAtt": [ + "AlarmFeature9DD74C42", + "Arn" + ] + } + } + }, + "alarmLambdaFeatureAliasaliasName16F91D34": { + "Type": "AWS::Lambda::Alias", + "Properties": { + "FunctionName": { + "Ref": "alarmLambdaFeatureD560800F" + }, + "FunctionVersion": { + "Fn::GetAtt": [ + "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b", + "Version" + ] + }, + "Name": "aliasName" + } + }, + "alarmLambdaFeatureAliasaliasNameAlarmAlarmPermissionE344338D": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" + }, + "Principal": "lambda.alarms.cloudwatch.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::GetAtt": [ + "Alarm7103F465", + "Arn" + ] + } + } + }, + "alarmLambdaFeatureAliasaliasNameAlarmFeatureAlarmPermission6A0A5797": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" + }, + "Principal": "lambda.alarms.cloudwatch.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::GetAtt": [ + "AlarmFeature9DD74C42", + "Arn" + ] + } + } + }, + "alarmLambdaFeatureAlarmAlarmPermissionCF637A1C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "alarmLambdaFeatureD560800F", + "Arn" + ] + }, + "Principal": "lambda.alarms.cloudwatch.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::GetAtt": [ + "Alarm7103F465", + "Arn" + ] + } + } + }, + "alarmLambdaFeatureAlarmFeatureAlarmPermission7032FB2D": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "alarmLambdaFeatureD560800F", + "Arn" + ] + }, + "Principal": "lambda.alarms.cloudwatch.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::GetAtt": [ + "AlarmFeature9DD74C42", + "Arn" + ] + } + } + }, + "AlarmFeature9DD74C42": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ActionsEnabled": true, + "AlarmActions": [ + { + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" + }, + { + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" + }, + { + "Fn::GetAtt": [ + "alarmLambdaFeatureD560800F", + "Arn" + ] + } + ], + "ComparisonOperator": "GreaterThanThreshold", + "Dimensions": [ + { + "Name": "FunctionName", + "Value": { + "Ref": "inAlarmLambdaFeature6C78D351" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "Errors", + "Namespace": "AWS/Lambda", + "Period": 60, + "Statistic": "Sum", + "Threshold": 1, + "TreatMissingData": "notBreaching" + } + } + }, + "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-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets.json new file mode 100644 index 0000000000000..3a2a261716167 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.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-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.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-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/integ.json index 0d675b8e2e251..3541451ac8f37 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/integ.json @@ -1,12 +1,12 @@ { "version": "36.0.0", "testCases": { - "LambdaAlarmActionIntegrationTest/DefaultTest": { + "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest": { "stacks": [ - "LambdaAlarmActionIntegrationTestStack" + "LambdaAlarmActionIntegrationTestStackWithFeatureFlag" ], - "assertionStack": "LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert", - "assertionStackName": "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5" + "assertionStack": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert", + "assertionStackName": "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/manifest.json index f7d89d600b988..ef633b1f8a767 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/manifest.json @@ -1,28 +1,28 @@ { "version": "36.0.0", "artifacts": { - "LambdaAlarmActionIntegrationTestStack.assets": { + "LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets": { "type": "cdk:asset-manifest", "properties": { - "file": "LambdaAlarmActionIntegrationTestStack.assets.json", + "file": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "LambdaAlarmActionIntegrationTestStack": { + "LambdaAlarmActionIntegrationTestStackWithFeatureFlag": { "type": "aws:cloudformation:stack", "environment": "aws://unknown-account/unknown-region", "properties": { - "templateFile": "LambdaAlarmActionIntegrationTestStack.template.json", + "templateFile": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag.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}/4e1c8f560b3bd32ad0758c6b7d04153c21111750f33dcfff05c52796bc71f9de.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/443cd498fca620868cfc5e66c6d03b3dcd2cc9d88b6eba24927a4e8d06ae7984.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ - "LambdaAlarmActionIntegrationTestStack.assets" + "LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets" ], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", @@ -31,130 +31,127 @@ } }, "dependencies": [ - "LambdaAlarmActionIntegrationTestStack.assets" + "LambdaAlarmActionIntegrationTestStackWithFeatureFlag.assets" ], "metadata": { - "/LambdaAlarmActionIntegrationTestStack/inAlarmLambda/ServiceRole/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "inAlarmLambdaServiceRole970DE64C" + "data": "inAlarmLambdaFeatureServiceRoleA2CD21D1" } ], - "/LambdaAlarmActionIntegrationTestStack/inAlarmLambda/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature/Resource": [ { "type": "aws:cdk:logicalId", - "data": "inAlarmLambda0920D101" + "data": "inAlarmLambdaFeature6C78D351" } ], - "/LambdaAlarmActionIntegrationTestStack/Alarm/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/Alarm/Resource": [ { "type": "aws:cdk:logicalId", "data": "Alarm7103F465" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature": [ { "type": "aws:cdk:warning", "data": "AWS Lambda has changed their authorization strategy, which may cause client invocations using the 'Qualifier' parameter of the lambda function to fail with Access Denied errors.\nIf you are using a lambda Version or Alias, make sure to call 'grantInvoke' or 'addPermission' on the Version or Alias, not the underlying Function\nSee: https://github.com/aws/aws-cdk/issues/19273 [ack: @aws-cdk/aws-lambda:addPermissionsToVersionOrAlias]" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/ServiceRole/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambdaServiceRoleCDAABB9D" + "data": "alarmLambdaFeatureServiceRole853A864D" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/Resource": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambda131DB691" + "data": "alarmLambdaFeatureD560800F" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/CurrentVersion/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion/Resource": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b" + "data": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/CurrentVersion/AlarmPermission": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion/AlarmAlarmPermission": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambdaCurrentVersionAlarmPermissionFEBD056F" + "data": "alarmLambdaFeatureCurrentVersionAlarmAlarmPermissionA0D80E66" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/AliasaliasName/Resource": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion/AlarmFeatureAlarmPermission": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambdaAliasaliasName41B27313" + "data": "alarmLambdaFeatureCurrentVersionAlarmFeatureAlarmPermission192451B4" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/AliasaliasName/AlarmPermission": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/Resource": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambdaAliasaliasNameAlarmPermission64A91652" + "data": "alarmLambdaFeatureAliasaliasName16F91D34" } ], - "/LambdaAlarmActionIntegrationTestStack/alarmLambda/AlarmPermission": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/AlarmAlarmPermission": [ { "type": "aws:cdk:logicalId", - "data": "alarmLambdaAlarmPermission43E41C89" + "data": "alarmLambdaFeatureAliasaliasNameAlarmAlarmPermissionE344338D" } ], - "/LambdaAlarmActionIntegrationTestStack/BootstrapVersion": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/AlarmFeatureAlarmPermission": [ { "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" + "data": "alarmLambdaFeatureAliasaliasNameAlarmFeatureAlarmPermission6A0A5797" } ], - "/LambdaAlarmActionIntegrationTestStack/CheckBootstrapVersion": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AlarmAlarmPermission": [ { "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" + "data": "alarmLambdaFeatureAlarmAlarmPermissionCF637A1C" + } + ], + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AlarmFeatureAlarmPermission": [ + { + "type": "aws:cdk:logicalId", + "data": "alarmLambdaFeatureAlarmFeatureAlarmPermission7032FB2D" } ], - "AlarmCurrentVersionAlarmPermission22DB4772": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/AlarmFeature/Resource": [ { "type": "aws:cdk:logicalId", - "data": "AlarmCurrentVersionAlarmPermission22DB4772", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] + "data": "AlarmFeature9DD74C42" } ], - "AlarmAliasaliasNameAlarmPermission3887D390": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/BootstrapVersion": [ { "type": "aws:cdk:logicalId", - "data": "AlarmAliasaliasNameAlarmPermission3887D390", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] + "data": "BootstrapVersion" } ], - "AlarmalarmLambdaAlarmPermission5CAF3DE7": [ + "/LambdaAlarmActionIntegrationTestStackWithFeatureFlag/CheckBootstrapVersion": [ { "type": "aws:cdk:logicalId", - "data": "AlarmalarmLambdaAlarmPermission5CAF3DE7", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] + "data": "CheckBootstrapVersion" } ] }, - "displayName": "LambdaAlarmActionIntegrationTestStack" + "displayName": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag" }, - "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5.assets": { + "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets": { "type": "cdk:asset-manifest", "properties": { - "file": "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5.assets.json", + "file": "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5": { + "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A": { "type": "aws:cloudformation:stack", "environment": "aws://unknown-account/unknown-region", "properties": { - "templateFile": "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5.template.json", + "templateFile": "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.template.json", "terminationProtection": false, "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", @@ -163,7 +160,7 @@ "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ - "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5.assets" + "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets" ], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", @@ -172,23 +169,23 @@ } }, "dependencies": [ - "LambdaAlarmActionIntegrationTestDefaultTestDeployAssertF9F882E5.assets" + "LambdaAlarmActionIntegrationTestWithFeatureFlagDefaultTestDeployAssertB72D1A4A.assets" ], "metadata": { - "/LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert/BootstrapVersion": [ + "/LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert/BootstrapVersion": [ { "type": "aws:cdk:logicalId", "data": "BootstrapVersion" } ], - "/LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + "/LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert/CheckBootstrapVersion": [ { "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } ] }, - "displayName": "LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert" + "displayName": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert" }, "Tree": { "type": "cdk:tree", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/tree.json index 622364ad86c22..bdbfec8ea97a8 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.js.snapshot/tree.json @@ -4,29 +4,29 @@ "id": "App", "path": "", "children": { - "LambdaAlarmActionIntegrationTestStack": { - "id": "LambdaAlarmActionIntegrationTestStack", - "path": "LambdaAlarmActionIntegrationTestStack", + "LambdaAlarmActionIntegrationTestStackWithFeatureFlag": { + "id": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag", "children": { - "inAlarmLambda": { - "id": "inAlarmLambda", - "path": "LambdaAlarmActionIntegrationTestStack/inAlarmLambda", + "inAlarmLambdaFeature": { + "id": "inAlarmLambdaFeature", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "LambdaAlarmActionIntegrationTestStack/inAlarmLambda/ServiceRole", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature/ServiceRole", "children": { "ImportServiceRole": { "id": "ImportServiceRole", - "path": "LambdaAlarmActionIntegrationTestStack/inAlarmLambda/ServiceRole/ImportServiceRole", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature/ServiceRole/ImportServiceRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/inAlarmLambda/ServiceRole/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -59,30 +59,30 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/inAlarmLambda/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/inAlarmLambdaFeature/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { "code": { "zipFile": "exports.handler = function handler(event, _context, callback) {\n console.log(JSON.stringify(event, undefined, 2));\n return callback();\n}" }, - "functionName": "inAlarmLambda", + "functionName": "inAlarmLambdaFeature", "handler": "index.handler", "role": { "Fn::GetAtt": [ - "inAlarmLambdaServiceRole970DE64C", + "inAlarmLambdaFeatureServiceRoleA2CD21D1", "Arn" ] }, @@ -90,37 +90,37 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Alarm": { "id": "Alarm", - "path": "LambdaAlarmActionIntegrationTestStack/Alarm", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/Alarm", "children": { "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/Alarm/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/Alarm/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", "aws:cdk:cloudformation:props": { "actionsEnabled": true, "alarmActions": [ { - "Ref": "alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b" + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" }, { - "Ref": "alarmLambdaAliasaliasName41B27313" + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" }, { "Fn::GetAtt": [ - "alarmLambda131DB691", + "alarmLambdaFeatureD560800F", "Arn" ] } @@ -130,7 +130,7 @@ { "name": "FunctionName", "value": { - "Ref": "inAlarmLambda0920D101" + "Ref": "inAlarmLambdaFeature6C78D351" } } ], @@ -144,35 +144,35 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, - "alarmLambda": { - "id": "alarmLambda", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda", + "alarmLambdaFeature": { + "id": "alarmLambdaFeature", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/ServiceRole", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/ServiceRole", "children": { "ImportServiceRole": { "id": "ImportServiceRole", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/ServiceRole/ImportServiceRole", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/ServiceRole/ImportServiceRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/ServiceRole/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -205,30 +205,30 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { "code": { "zipFile": "exports.handler = function handler(event, _context, callback) {\n console.log(JSON.stringify(event, undefined, 2));\n return callback();\n}" }, - "functionName": "alarmLambda", + "functionName": "alarmLambdaFeature", "handler": "index.handler", "role": { "Fn::GetAtt": [ - "alarmLambdaServiceRoleCDAABB9D", + "alarmLambdaFeatureServiceRole853A864D", "Arn" ] }, @@ -236,39 +236,39 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "CurrentVersion": { "id": "CurrentVersion", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/CurrentVersion", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion", "children": { "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/CurrentVersion/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Version", "aws:cdk:cloudformation:props": { "functionName": { - "Ref": "alarmLambda131DB691" + "Ref": "alarmLambdaFeatureD560800F" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnVersion", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, - "AlarmPermission": { - "id": "AlarmPermission", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/CurrentVersion/AlarmPermission", + "AlarmAlarmPermission": { + "id": "AlarmAlarmPermission", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion/AlarmAlarmPermission", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { "action": "lambda:InvokeFunction", "functionName": { - "Ref": "alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b" + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" }, "principal": "lambda.alarms.cloudwatch.amazonaws.com", "sourceAccount": { @@ -283,32 +283,59 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "AlarmFeatureAlarmPermission": { + "id": "AlarmFeatureAlarmPermission", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/CurrentVersion/AlarmFeatureAlarmPermission", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" + }, + "principal": "lambda.alarms.cloudwatch.amazonaws.com", + "sourceAccount": { + "Ref": "AWS::AccountId" + }, + "sourceArn": { + "Fn::GetAtt": [ + "AlarmFeature9DD74C42", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.Version", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "AliasaliasName": { "id": "AliasaliasName", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/AliasaliasName", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName", "children": { "Resource": { "id": "Resource", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/AliasaliasName/Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Alias", "aws:cdk:cloudformation:props": { "functionName": { - "Ref": "alarmLambda131DB691" + "Ref": "alarmLambdaFeatureD560800F" }, "functionVersion": { "Fn::GetAtt": [ - "alarmLambdaCurrentVersionBDCE825C61967a018dfe55c69152d31b6e7ab40b", + "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b", "Version" ] }, @@ -316,27 +343,27 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnAlias", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "ScalingRole": { "id": "ScalingRole", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/AliasaliasName/ScalingRole", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/ScalingRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, - "AlarmPermission": { - "id": "AlarmPermission", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/AliasaliasName/AlarmPermission", + "AlarmAlarmPermission": { + "id": "AlarmAlarmPermission", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/AlarmAlarmPermission", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { "action": "lambda:InvokeFunction", "functionName": { - "Ref": "alarmLambdaAliasaliasName41B27313" + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" }, "principal": "lambda.alarms.cloudwatch.amazonaws.com", "sourceAccount": { @@ -351,26 +378,53 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "AlarmFeatureAlarmPermission": { + "id": "AlarmFeatureAlarmPermission", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AliasaliasName/AlarmFeatureAlarmPermission", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" + }, + "principal": "lambda.alarms.cloudwatch.amazonaws.com", + "sourceAccount": { + "Ref": "AWS::AccountId" + }, + "sourceArn": { + "Fn::GetAtt": [ + "AlarmFeature9DD74C42", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.Alias", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, - "AlarmPermission": { - "id": "AlarmPermission", - "path": "LambdaAlarmActionIntegrationTestStack/alarmLambda/AlarmPermission", + "AlarmAlarmPermission": { + "id": "AlarmAlarmPermission", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AlarmAlarmPermission", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { "action": "lambda:InvokeFunction", "functionName": { "Fn::GetAtt": [ - "alarmLambda131DB691", + "alarmLambdaFeatureD560800F", "Arn" ] }, @@ -387,49 +441,133 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "AlarmFeatureAlarmPermission": { + "id": "AlarmFeatureAlarmPermission", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/alarmLambdaFeature/AlarmFeatureAlarmPermission", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "alarmLambdaFeatureD560800F", + "Arn" + ] + }, + "principal": "lambda.alarms.cloudwatch.amazonaws.com", + "sourceAccount": { + "Ref": "AWS::AccountId" + }, + "sourceArn": { + "Fn::GetAtt": [ + "AlarmFeature9DD74C42", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "AlarmFeature": { + "id": "AlarmFeature", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/AlarmFeature", + "children": { + "Resource": { + "id": "Resource", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/AlarmFeature/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "actionsEnabled": true, + "alarmActions": [ + { + "Ref": "alarmLambdaFeatureCurrentVersionCF39751979501d2f67eaf906b2ef0c378303873b" + }, + { + "Ref": "alarmLambdaFeatureAliasaliasName16F91D34" + }, + { + "Fn::GetAtt": [ + "alarmLambdaFeatureD560800F", + "Arn" + ] + } + ], + "comparisonOperator": "GreaterThanThreshold", + "dimensions": [ + { + "name": "FunctionName", + "value": { + "Ref": "inAlarmLambdaFeature6C78D351" + } + } + ], + "evaluationPeriods": 1, + "metricName": "Errors", + "namespace": "AWS/Lambda", + "period": 60, + "statistic": "Sum", + "threshold": 1, + "treatMissingData": "notBreaching" + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "BootstrapVersion": { "id": "BootstrapVersion", - "path": "LambdaAlarmActionIntegrationTestStack/BootstrapVersion", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/BootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", - "path": "LambdaAlarmActionIntegrationTestStack/CheckBootstrapVersion", + "path": "LambdaAlarmActionIntegrationTestStackWithFeatureFlag/CheckBootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, - "LambdaAlarmActionIntegrationTest": { - "id": "LambdaAlarmActionIntegrationTest", - "path": "LambdaAlarmActionIntegrationTest", + "LambdaAlarmActionIntegrationTestWithFeatureFlag": { + "id": "LambdaAlarmActionIntegrationTestWithFeatureFlag", + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlag", "children": { "DefaultTest": { "id": "DefaultTest", - "path": "LambdaAlarmActionIntegrationTest/DefaultTest", + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest", "children": { "Default": { "id": "Default", - "path": "LambdaAlarmActionIntegrationTest/DefaultTest/Default", + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -437,28 +575,28 @@ }, "DeployAssert": { "id": "DeployAssert", - "path": "LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert", + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert", "children": { "BootstrapVersion": { "id": "BootstrapVersion", - "path": "LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert/BootstrapVersion", + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", - "path": "LambdaAlarmActionIntegrationTest/DefaultTest/DeployAssert/CheckBootstrapVersion", + "path": "LambdaAlarmActionIntegrationTestWithFeatureFlag/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, @@ -483,8 +621,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.App", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.ts index 25fa92a34464d..48e806f6f191b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.lambda-alarm-action.ts @@ -1,16 +1,21 @@ -import { App, Stack, StackProps, Duration } from 'aws-cdk-lib'; +import { App, Stack, StackProps, Duration, FeatureFlags } from 'aws-cdk-lib'; import * as integ from '@aws-cdk/integ-tests-alpha'; import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { STANDARD_NODEJS_RUNTIME } from '../../config'; import * as cloudwatchActions from 'aws-cdk-lib/aws-cloudwatch-actions'; +import { LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION } from 'aws-cdk-lib/cx-api'; class LambdaAlarmActionIntegrationTestStack extends Stack { constructor(scope: App, id: string, props?: StackProps) { super(scope, id, props); - const inAlarmLambda = new lambda.Function(this, 'inAlarmLambda', { - functionName: 'inAlarmLambda', + + const isFeature = FeatureFlags.of(this).isEnabled(LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION); + const lambdaIdSuffix = isFeature ? 'Feature' : ''; + + const inAlarmLambda = new lambda.Function(this, `inAlarmLambda${lambdaIdSuffix}`, { + functionName: `inAlarmLambda${lambdaIdSuffix}`, runtime: STANDARD_NODEJS_RUNTIME, handler: 'index.handler', code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), @@ -24,8 +29,8 @@ class LambdaAlarmActionIntegrationTestStack extends Stack { treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING, }); - const alarmLambda = new lambda.Function(this, 'alarmLambda', { - functionName: 'alarmLambda', + const alarmLambda = new lambda.Function(this, `alarmLambda${lambdaIdSuffix}`, { + functionName: `alarmLambda${lambdaIdSuffix}`, runtime: STANDARD_NODEJS_RUNTIME, handler: 'index.handler', code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), @@ -35,19 +40,39 @@ class LambdaAlarmActionIntegrationTestStack extends Stack { alarm.addAlarmAction(new cloudwatchActions.LambdaAction(version)); alarm.addAlarmAction(new cloudwatchActions.LambdaAction(aliasName)); alarm.addAlarmAction(new cloudwatchActions.LambdaAction(alarmLambda)); + + if (isFeature) { + const alarm2 = new cloudwatch.Alarm(this, `Alarm${lambdaIdSuffix}`, { + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + metric: inAlarmLambda.metricErrors({ period: Duration.minutes(1) }), + actionsEnabled: true, + treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING, + }); + alarm2.addAlarmAction(new cloudwatchActions.LambdaAction(version)); + alarm2.addAlarmAction(new cloudwatchActions.LambdaAction(aliasName)); + alarm2.addAlarmAction(new cloudwatchActions.LambdaAction(alarmLambda)); + } } } const app = new App(); - const stack = new LambdaAlarmActionIntegrationTestStack(app, 'LambdaAlarmActionIntegrationTestStack'); - new integ.IntegTest(app, 'LambdaAlarmActionIntegrationTest', { testCases: [stack], }); - app.synth(); +const appWithFeatureFlag = new App({ + context: { [LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION]: true }, +}); +const stackWithFeatureFlag = new LambdaAlarmActionIntegrationTestStack(appWithFeatureFlag, 'LambdaAlarmActionIntegrationTestStackWithFeatureFlag'); +new integ.IntegTest(appWithFeatureFlag, 'LambdaAlarmActionIntegrationTestWithFeatureFlag', { + testCases: [stackWithFeatureFlag], +}); +appWithFeatureFlag.synth(); + /* eslint-disable no-console */ function handler(event: any, _context: any, callback: any) { console.log(JSON.stringify(event, undefined, 2)); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ-user-pool-link-custom-placeholder.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ-user-pool-link-custom-placeholder.assets.json new file mode 100644 index 0000000000000..cb5c759a25aec --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ-user-pool-link-custom-placeholder.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "8933ce2d15790f339b208cf26b074a443813cb433115af260ab927c97e241c47": { + "source": { + "path": "integ-user-pool-link-custom-placeholder.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8933ce2d15790f339b208cf26b074a443813cb433115af260ab927c97e241c47.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-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ-user-pool-link-custom-placeholder.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ-user-pool-link-custom-placeholder.template.json new file mode 100644 index 0000000000000..7d982cb5fbff6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ-user-pool-link-custom-placeholder.template.json @@ -0,0 +1,76 @@ +{ + "Resources": { + "myuserpool01998219": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AccountRecoverySetting": { + "RecoveryMechanisms": [ + { + "Name": "verified_phone_number", + "Priority": 1 + }, + { + "Name": "verified_email", + "Priority": 2 + } + ] + }, + "AdminCreateUserConfig": { + "AllowAdminCreateUserOnly": true + }, + "DeletionProtection": "INACTIVE", + "SmsVerificationMessage": "The verification code to your new account is {####}", + "UserPoolName": "MyUserPool", + "VerificationMessageTemplate": { + "DefaultEmailOption": "CONFIRM_WITH_LINK", + "EmailMessageByLink": "You have been invited to join our awesome app! {##Click here to verify your email##}", + "EmailSubjectByLink": "Invite to join our awesome app!", + "SmsMessage": "The verification code to your new account is {####}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Outputs": { + "userpoolid": { + "Value": { + "Ref": "myuserpool01998219" + } + } + }, + "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-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ.json new file mode 100644 index 0000000000000..837060dde243f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/integ.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "testCases": { + "user-pool-link-custom-placeholder-integ-test/DefaultTest": { + "stacks": [ + "integ-user-pool-link-custom-placeholder" + ], + "cdkCommandOptions": { + "deploy": { + "args": { + "rollback": true + } + } + }, + "assertionStack": "user-pool-link-custom-placeholder-integ-test/DefaultTest/DeployAssert", + "assertionStackName": "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/manifest.json new file mode 100644 index 0000000000000..e3a71d145f54d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/manifest.json @@ -0,0 +1,119 @@ +{ + "version": "36.0.0", + "artifacts": { + "integ-user-pool-link-custom-placeholder.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-user-pool-link-custom-placeholder.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-user-pool-link-custom-placeholder": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-user-pool-link-custom-placeholder.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}/8933ce2d15790f339b208cf26b074a443813cb433115af260ab927c97e241c47.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-user-pool-link-custom-placeholder.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-user-pool-link-custom-placeholder.assets" + ], + "metadata": { + "/integ-user-pool-link-custom-placeholder/myuserpool/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpool01998219" + } + ], + "/integ-user-pool-link-custom-placeholder/user-pool-id": [ + { + "type": "aws:cdk:logicalId", + "data": "userpoolid" + } + ], + "/integ-user-pool-link-custom-placeholder/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-user-pool-link-custom-placeholder/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-user-pool-link-custom-placeholder" + }, + "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.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": [ + "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.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": [ + "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.assets" + ], + "metadata": { + "/user-pool-link-custom-placeholder-integ-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/user-pool-link-custom-placeholder-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "user-pool-link-custom-placeholder-integ-test/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-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/tree.json new file mode 100644 index 0000000000000..d66f0e544396f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/tree.json @@ -0,0 +1,156 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-user-pool-link-custom-placeholder": { + "id": "integ-user-pool-link-custom-placeholder", + "path": "integ-user-pool-link-custom-placeholder", + "children": { + "myuserpool": { + "id": "myuserpool", + "path": "integ-user-pool-link-custom-placeholder/myuserpool", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-user-pool-link-custom-placeholder/myuserpool/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Cognito::UserPool", + "aws:cdk:cloudformation:props": { + "accountRecoverySetting": { + "recoveryMechanisms": [ + { + "name": "verified_phone_number", + "priority": 1 + }, + { + "name": "verified_email", + "priority": 2 + } + ] + }, + "adminCreateUserConfig": { + "allowAdminCreateUserOnly": true + }, + "deletionProtection": "INACTIVE", + "smsVerificationMessage": "The verification code to your new account is {####}", + "userPoolName": "MyUserPool", + "verificationMessageTemplate": { + "defaultEmailOption": "CONFIRM_WITH_LINK", + "emailMessageByLink": "You have been invited to join our awesome app! {##Click here to verify your email##}", + "emailSubjectByLink": "Invite to join our awesome app!", + "smsMessage": "The verification code to your new account is {####}" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cognito.CfnUserPool", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cognito.UserPool", + "version": "0.0.0" + } + }, + "user-pool-id": { + "id": "user-pool-id", + "path": "integ-user-pool-link-custom-placeholder/user-pool-id", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-user-pool-link-custom-placeholder/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-user-pool-link-custom-placeholder/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "user-pool-link-custom-placeholder-integ-test": { + "id": "user-pool-link-custom-placeholder-integ-test", + "path": "user-pool-link-custom-placeholder-integ-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "user-pool-link-custom-placeholder-integ-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "user-pool-link-custom-placeholder-integ-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "user-pool-link-custom-placeholder-integ-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "user-pool-link-custom-placeholder-integ-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "user-pool-link-custom-placeholder-integ-test/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-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.assets.json new file mode 100644 index 0000000000000..819351d69a81e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.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-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.js.snapshot/userpoollinkcustomplaceholderintegtestDefaultTestDeployAssert5C199314.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-cognito/test/integ.user-pool-link-custom-placeholder.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.ts new file mode 100644 index 0000000000000..65e04962e0437 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-link-custom-placeholder.ts @@ -0,0 +1,32 @@ +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool, VerificationEmailStyle } from 'aws-cdk-lib/aws-cognito'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +const app = new App(); +const stack = new Stack(app, 'integ-user-pool-link-custom-placeholder'); + +const userpool = new UserPool(stack, 'myuserpool', { + userPoolName: 'MyUserPool', + removalPolicy: RemovalPolicy.DESTROY, + deletionProtection: false, + userVerification: { + emailStyle: VerificationEmailStyle.LINK, + emailSubject: 'Invite to join our awesome app!', + emailBody: 'You have been invited to join our awesome app! {##Click here to verify your email##}', + }, +}); + +new CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); + +new IntegTest(app, 'user-pool-link-custom-placeholder-integ-test', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.assets.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.assets.json new file mode 100644 index 0000000000000..bf0cd5ed3a1c2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "DeletionPolicyTestDefaultTestDeployAssert6189EF04.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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.template.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.assets.json new file mode 100644 index 0000000000000..4f2896026d3a3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "2ec981d249c5fd2e1befd964a3ffcb115d1eb16b36017d923fe1ced27352e0e5": { + "source": { + "path": "Stack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "2ec981d249c5fd2e1befd964a3ffcb115d1eb16b36017d923fe1ced27352e0e5.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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.template.json new file mode 100644 index 0000000000000..690634ca5efe7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.template.json @@ -0,0 +1,58 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "DeletionPolicy": { + "Fn::If": [ + "AlwaysFalseCond", + "Retain", + "Delete" + ] + } + } + }, + "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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/integ.json new file mode 100644 index 0000000000000..a2fda9175aada --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "DeletionPolicyTest/DefaultTest": { + "stacks": [ + "Stack" + ], + "assertionStack": "DeletionPolicyTest/DefaultTest/DeployAssert", + "assertionStackName": "DeletionPolicyTestDefaultTestDeployAssert6189EF04" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/manifest.json new file mode 100644 index 0000000000000..9aeb2b31b724f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/manifest.json @@ -0,0 +1,125 @@ +{ + "version": "36.0.0", + "artifacts": { + "Stack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "Stack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "Stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "Stack.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}/2ec981d249c5fd2e1befd964a3ffcb115d1eb16b36017d923fe1ced27352e0e5.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "Stack.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": [ + "Stack.assets" + ], + "metadata": { + "/Stack/Stack": [ + { + "type": "aws:cdk:logicalId", + "data": "Stack" + } + ], + "/Stack/Stack/$Conditions/AlwaysFalseCond": [ + { + "type": "aws:cdk:logicalId", + "data": "AlwaysFalseCond" + } + ], + "/Stack/Stack/Bucket": [ + { + "type": "aws:cdk:logicalId", + "data": "Bucket" + } + ], + "/Stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/Stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "Stack" + }, + "DeletionPolicyTestDefaultTestDeployAssert6189EF04.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "DeletionPolicyTestDefaultTestDeployAssert6189EF04.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "DeletionPolicyTestDefaultTestDeployAssert6189EF04": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "DeletionPolicyTestDefaultTestDeployAssert6189EF04.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": [ + "DeletionPolicyTestDefaultTestDeployAssert6189EF04.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": [ + "DeletionPolicyTestDefaultTestDeployAssert6189EF04.assets" + ], + "metadata": { + "/DeletionPolicyTest/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/DeletionPolicyTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "DeletionPolicyTest/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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/tree.json new file mode 100644 index 0000000000000..3c5b96273ac99 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/tree.json @@ -0,0 +1,173 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Stack": { + "id": "Stack", + "path": "Stack", + "children": { + "Stack": { + "id": "Stack", + "path": "Stack/Stack", + "children": { + "$Mappings": { + "id": "$Mappings", + "path": "Stack/Stack/$Mappings", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "$Conditions": { + "id": "$Conditions", + "path": "Stack/Stack/$Conditions", + "children": { + "AlwaysFalseCond": { + "id": "AlwaysFalseCond", + "path": "Stack/Stack/$Conditions/AlwaysFalseCond", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnCondition", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "$Rules": { + "id": "$Rules", + "path": "Stack/Stack/$Rules", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Bucket": { + "id": "Bucket", + "path": "Stack/Stack/Bucket", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "$Hooks": { + "id": "$Hooks", + "path": "Stack/Stack/$Hooks", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "$Ouputs": { + "id": "$Ouputs", + "path": "Stack/Stack/$Ouputs", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.cloudformation_include.CfnInclude", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "Stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "Stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "DeletionPolicyTest": { + "id": "DeletionPolicyTest", + "path": "DeletionPolicyTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "DeletionPolicyTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "DeletionPolicyTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "DeletionPolicyTest/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "DeletionPolicyTest/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "DeletionPolicyTest/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-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.ts b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.ts new file mode 100644 index 0000000000000..65e88a5e24757 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.ts @@ -0,0 +1,15 @@ +import * as core from 'aws-cdk-lib'; +import * as inc from 'aws-cdk-lib/cloudformation-include'; +import * as integ from '@aws-cdk/integ-tests-alpha'; + +const app = new core.App(); + +const stack = new core.Stack(app, 'Stack'); + +new inc.CfnInclude(stack, 'Stack', { + templateFile: 'test-templates/fn-if-deletion-policy.json', +}); + +new integ.IntegTest(app, 'DeletionPolicyTest', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-if-deletion-policy.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-if-deletion-policy.json new file mode 100644 index 0000000000000..f8d6909224108 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-if-deletion-policy.json @@ -0,0 +1,25 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "DeletionPolicy": { + "Fn::If": [ + "AlwaysFalseCond", + "Retain", + "Delete" + ] + } + } + } + } + \ No newline at end of file diff --git a/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md b/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md index 95817e6176cb4..6ba99522b8f73 100644 --- a/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md +++ b/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md @@ -63,6 +63,7 @@ Flags come in three types: | [@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters](#aws-cdkaws-rdsauroraclusterchangescopeofinstanceparametergroupwitheachparameters) | When enabled, a scope of InstanceParameterGroup for AuroraClusterInstance with each parameters will change. | 2.97.0 | (fix) | | [@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials](#aws-cdkaws-rdspreventrenderingdeprecatedcredentials) | When enabled, creating an RDS database cluster from a snapshot will only render credentials for snapshot credentials. | 2.98.0 | (fix) | | [@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource](#aws-cdkaws-codepipeline-actionsusenewdefaultbranchforcodecommitsource) | When enabled, the CodeCommit source action is using the default branch name 'main'. | 2.103.1 | (fix) | +| [@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction](#aws-cdkaws-cloudwatch-actionschangelambdapermissionlogicalidforlambdaaction) | When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID. | V2NEXT | (fix) | @@ -116,7 +117,8 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true, "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true, "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true, - "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true + "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true, + "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true } } ``` @@ -1193,4 +1195,22 @@ However, with the activation of this feature flag, the default branch is updated | 2.103.1 | `false` | `true` | +### @aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction + +*When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID.* (fix) + +When this feature flag is enabled, a logical ID of `LambdaPermission` for a +`LambdaAction` will include an alarm ID. Therefore multiple alarms for the same Lambda +can be created with `LambdaAction`. + +If the flag is set to false then it can only make one alarm for the Lambda with +`LambdaAction`. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| V2NEXT | `false` | `true` | + + diff --git a/packages/aws-cdk-lib/aws-cloudfront/README.md b/packages/aws-cdk-lib/aws-cloudfront/README.md index 333367b4ec176..6c9aa2d3a461c 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/README.md +++ b/packages/aws-cdk-lib/aws-cloudfront/README.md @@ -558,6 +558,19 @@ const store = new cloudfront.KeyValueStore(this, 'KeyValueStore', { }); ``` +The Key Value Store can then be associated to a function using the `cloudfront-js-2.0` runtime +or newer: + +```ts +const store = new cloudfront.KeyValueStore(this, 'KeyValueStore'); +new cloudfront.Function(this, 'Function', { + code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'), + // Note that JS_2_0 must be used for Key Value Store support + runtime: cloudfront.FunctionRuntime.JS_2_0, + keyValueStore: store, +}); +``` + ### Logging You can configure CloudFront to create log files that contain detailed information about every user request that CloudFront receives. diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts index 71b874adb1934..bdf72350b689e 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts @@ -1,6 +1,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'; /** @@ -132,9 +133,19 @@ export interface FunctionProps { /** * The runtime environment for the function. - * @default FunctionRuntime.JS_1_0 + * @default FunctionRuntime.JS_1_0 (unless `keyValueStore` is specified, then `FunctionRuntime.JS_2_0`) */ readonly runtime?: FunctionRuntime; + + /** + * The Key Value Store to associate with this function. + * + * In order to associate a Key Value Store, the `runtime` must be + * `cloudfront-js-2.0` or newer. + * + * @default - no key value store is associated + */ + readonly keyValueStore?: IKeyValueStore; } /** @@ -179,7 +190,14 @@ export class Function extends Resource implements IFunction { this.functionName = props.functionName ?? this.generateName(); - this.functionRuntime = props.runtime?.value ?? FunctionRuntime.JS_1_0.value; + const defaultFunctionRuntime = props.keyValueStore ? FunctionRuntime.JS_2_0.value : FunctionRuntime.JS_1_0.value; + this.functionRuntime = props.runtime?.value ?? defaultFunctionRuntime; + + if (props.keyValueStore && this.functionRuntime === FunctionRuntime.JS_1_0.value) { + throw new Error( + `Key Value Stores cannot be associated to functions using the ${this.functionRuntime} runtime`, + ); + } const resource = new CfnFunction(this, 'Resource', { autoPublish: true, @@ -187,6 +205,7 @@ export class Function extends Resource implements IFunction { functionConfig: { comment: props.comment ?? this.functionName, runtime: this.functionRuntime, + keyValueStoreAssociations: props.keyValueStore ? [{ keyValueStoreArn: props.keyValueStore.keyValueStoreArn }] : undefined, }, name: this.functionName, }); 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 142559b07ea7c..5e17a59362535 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '../../assertions'; +import { Template, Match } from '../../assertions'; import { App, Stack } from '../../core'; -import { Function, FunctionCode, FunctionRuntime } from '../lib'; +import { Function, FunctionCode, FunctionRuntime, KeyValueStore } from '../lib'; describe('CloudFront Function', () => { @@ -188,4 +188,72 @@ describe('CloudFront Function', () => { }, }); }); + + describe('key value store association', () => { + test('minimal example', () => { + const stack = new Stack(); + const keyValueStore = new KeyValueStore(stack, 'TestStore'); + + new Function(stack, 'TestFn', { + code: FunctionCode.fromInline('code'), + keyValueStore, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', { + FunctionConfig: { + Runtime: 'cloudfront-js-2.0', + KeyValueStoreAssociations: [{ + KeyValueStoreARN: stack.resolve(keyValueStore.keyValueStoreArn), + }], + }, + }); + }); + + test('rejects key value store with v1.0 runtime', () => { + const stack = new Stack(); + const keyValueStore = new KeyValueStore(stack, 'TestStore'); + + expect(() => new Function(stack, 'TestFn', { + code: FunctionCode.fromInline('code'), + runtime: FunctionRuntime.JS_1_0, + keyValueStore, + })).toThrow(/Key Value Stores cannot be associated to functions using the .* runtime/); + }); + + test('works with js-2.0 runtime specified', () => { + const stack = new Stack(); + const keyValueStore = new KeyValueStore(stack, 'TestStore'); + + new Function(stack, 'TestFn', { + code: FunctionCode.fromInline('code'), + runtime: FunctionRuntime.JS_2_0, + keyValueStore, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', { + FunctionConfig: { + Runtime: 'cloudfront-js-2.0', + KeyValueStoreAssociations: [{ + KeyValueStoreARN: stack.resolve(keyValueStore.keyValueStoreArn), + }], + }, + }); + }); + + test('no value is used in CloudFormation when unspecified in CDK', () => { + const stack = new Stack(); + + new Function(stack, 'TestFn', { + code: FunctionCode.fromInline('code'), + runtime: FunctionRuntime.JS_2_0, + keyValueStore: undefined, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Function', { + FunctionConfig: { + KeyValueStoreAssociations: Match.absent(), + }, + }); + }); + }); }); diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/lambda.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/lambda.ts index f754b60b3f1a5..13312dc51caa9 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/lambda.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/lambda.ts @@ -2,7 +2,8 @@ import { Construct } from 'constructs'; import * as cloudwatch from '../../aws-cloudwatch'; import * as iam from '../../aws-iam'; import * as lambda from '../../aws-lambda'; -import { Stack } from '../../core'; +import { FeatureFlags, Stack } from '../../core'; +import { LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION } from '../../cx-api'; /** * Use a Lambda action as an Alarm action @@ -20,11 +21,12 @@ export class LambdaAction implements cloudwatch.IAlarmAction { * * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricAlarm.html */ - bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { - this.lambdaFunction.addPermission('AlarmPermission', { - sourceAccount: Stack.of(_scope).account, + bind(scope: Construct, alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { + const idPrefix = FeatureFlags.of(scope).isEnabled(LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION) ? alarm.node.id : ''; + this.lambdaFunction.addPermission(`${idPrefix}AlarmPermission`, { + sourceAccount: Stack.of(scope).account, action: 'lambda:InvokeFunction', - sourceArn: _alarm.alarmArn, + sourceArn: alarm.alarmArn, principal: new iam.ServicePrincipal('lambda.alarms.cloudwatch.amazonaws.com'), }); diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/test/lambda.test.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/lambda.test.ts index 03e71b40b0cbb..027dfcd3f17f6 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch-actions/test/lambda.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/lambda.test.ts @@ -2,6 +2,7 @@ import { Template } from '../../assertions'; import * as cloudwatch from '../../aws-cloudwatch'; import * as lambda from '../../aws-lambda'; import { Stack } from '../../core'; +import { LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION } from '../../cx-api'; import * as actions from '../lib/index'; test('can use lambda as alarm action', () => { @@ -111,3 +112,70 @@ def handler(event, context): }); }); +test('can create multiple alarms for the same lambda if feature flag is set', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION, true); + const alarm1 = new cloudwatch.Alarm(stack, 'Alarm1', { + metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Test' }), + evaluationPeriods: 3, + threshold: 100, + }); + const alarm2 = new cloudwatch.Alarm(stack, 'Alarm2', { + metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Test2' }), + evaluationPeriods: 3, + threshold: 100, + }); + + // WHEN + const alarmLambda = new lambda.Function(stack, 'alarmLambda', { + runtime: lambda.Runtime.PYTHON_3_12, + functionName: 'alarmLambda', + code: lambda.Code.fromInline(` +def handler(event, context): + print('event:', event) + print('.............................................') + print('context:', context)`), + handler: 'index.handler', + }); + alarm1.addAlarmAction(new actions.LambdaAction(alarmLambda)); + alarm2.addAlarmAction(new actions.LambdaAction(alarmLambda)); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::CloudWatch::Alarm', 2); + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 2); +}); + +test('throws when multiple alarms are created for the same lambda if feature flag is set to false', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION, false); // Default, but explicit just in case. + const alarm1 = new cloudwatch.Alarm(stack, 'Alarm1', { + metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Test' }), + evaluationPeriods: 3, + threshold: 100, + }); + const alarm2 = new cloudwatch.Alarm(stack, 'Alarm2', { + metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Test2' }), + evaluationPeriods: 3, + threshold: 100, + }); + + // WHEN + const alarmLambda = new lambda.Function(stack, 'alarmLambda', { + runtime: lambda.Runtime.PYTHON_3_12, + functionName: 'alarmLambda', + code: lambda.Code.fromInline(` +def handler(event, context): + print('event:', event) + print('.............................................') + print('context:', context)`), + handler: 'index.handler', + }); + alarm1.addAlarmAction(new actions.LambdaAction(alarmLambda)); + + // THEN + expect(() => { + alarm2.addAlarmAction(new actions.LambdaAction(alarmLambda)); + }).toThrow(/There is already a Construct with name 'AlarmPermission' in Function \[alarmLambda\]/); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-cognito/README.md b/packages/aws-cdk-lib/aws-cognito/README.md index 8616cb0b929ab..ae7b91ecc4f5a 100644 --- a/packages/aws-cdk-lib/aws-cognito/README.md +++ b/packages/aws-cdk-lib/aws-cognito/README.md @@ -79,6 +79,11 @@ Users can either be signed up by the app's administrators or can sign themselves account needs to be confirmed. Cognito provides several ways to sign users up and confirm their accounts. Learn more about [user sign up here](https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html). +To verify the email address of a user in your user pool with Amazon Cognito, you can send the user an email message +with a link that they can select, or you can send them a code that they can enter. + +#### Code Verification + When a user signs up, email and SMS messages are used to verify their account and contact methods. The following code snippet configures a user pool with properties relevant to these verification messages - @@ -113,6 +118,20 @@ new cognito.UserPool(this, 'myuserpool', { }); ``` +#### Link Verification +Alternatively, users can use link as a verification method. The following code snippet configures a user pool with +properties relevant to these verification messages and link verification method. + +```ts +new cognito.UserPool(this, 'myuserpool', { + userVerification: { + emailStyle: cognito.VerificationEmailStyle.LINK, + emailSubject: 'Invite to join our awesome app!', + emailBody: 'You have been invited to join our awesome app! {##Verify Your Email##}', + }, +}); +``` + All email subjects, bodies and SMS messages for both invitation and verification support Cognito's message templating. Learn more about [message templates here](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-templates.html). diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts index aca961028a79a..8da548198eb32 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts @@ -1047,6 +1047,11 @@ export class UserPool extends UserPoolBase { private verificationMessageConfiguration(props: UserPoolProps): CfnUserPool.VerificationMessageTemplateProperty { const CODE_TEMPLATE = '{####}'; const VERIFY_EMAIL_TEMPLATE = '{##Verify Email##}'; + /** + * Email message placeholder regex + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-verificationmessagetemplate.html#cfn-cognito-userpool-verificationmessagetemplate-emailmessagebylink + */ + const VERIFY_EMAIL_REGEX = /\{##[\p{L}\p{M}\p{S}\p{N}\p{P}\s*]*##\}/u; const emailStyle = props.userVerification?.emailStyle ?? VerificationEmailStyle.CODE; const emailSubject = props.userVerification?.emailSubject ?? 'Verify your new account'; @@ -1069,7 +1074,7 @@ export class UserPool extends UserPoolBase { } else { const emailMessage = props.userVerification?.emailBody ?? `Verify your account by clicking on ${VERIFY_EMAIL_TEMPLATE}`; - if (!Token.isUnresolved(emailMessage) && emailMessage.indexOf(VERIFY_EMAIL_TEMPLATE) < 0) { + if (!Token.isUnresolved(emailMessage) && !VERIFY_EMAIL_REGEX.test(emailMessage)) { throw new Error(`Verification email body must contain the template string '${VERIFY_EMAIL_TEMPLATE}'`); } return { diff --git a/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts index af482b5abf1ab..b80c669e205d7 100644 --- a/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts @@ -159,14 +159,35 @@ describe('User Pool', () => { expect(() => new UserPool(stack, 'Pool5', { userVerification: { emailStyle: VerificationEmailStyle.LINK, - emailBody: 'invalid email body {####}', + emailBody: 'valid email body {####}', }, - })).toThrow(/Verification email body/); + })).not.toThrow(); expect(() => new UserPool(stack, 'Pool6', { userVerification: { emailStyle: VerificationEmailStyle.LINK, - emailBody: 'invalid email body {##Verify Email##}', + emailBody: 'valid email body {##Verify Email##}', + }, + })).not.toThrow(); + + expect(() => new UserPool(stack, 'Pool7', { + userVerification: { + emailStyle: VerificationEmailStyle.LINK, + emailBody: 'invalid email body ##Verify Email##', + }, + })).toThrow(/Verification email body/); + + expect(() => new UserPool(stack, 'Pool8', { + userVerification: { + emailStyle: VerificationEmailStyle.LINK, + emailBody: 'valid email body {##Verify !! Email##}', + }, + })).not.toThrow(); + + expect(() => new UserPool(stack, 'Pool9', { + userVerification: { + emailStyle: VerificationEmailStyle.LINK, + emailBody: 'valid email body {##Click here to verify##}', }, })).not.toThrow(); }); diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/intrinsic-deletion-policy-ref.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/intrinsic-deletion-policy-ref.json new file mode 100644 index 0000000000000..0b02ae68180bc --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/intrinsic-deletion-policy-ref.json @@ -0,0 +1,46 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Transform": "AWS::LanguageExtensions", + "Parameters": { + "DeletionPolicyParam": { + "Type": "String", + "AllowedValues": [ + "Delete", + "Retain", + "Snapshot" + ], + "Default": "Delete" + }, + "UpdateReplacePolicyParam": { + "Type": "String", + "AllowedValues": [ + "Delete", + "Retain", + "Snapshot" + ], + "Default": "Delete" + } + }, + "Resources": { + "Table": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "primaryKey", + "KeyType": "HASH" + }], + "AttributeDefinitions": [{ + "AttributeName": "primaryKey", + "AttributeType": "S" + }] + }, + "DeletionPolicy": { + "Ref": "DeletionPolicyParam" + }, + "UpdateReplacePolicy": { + "Ref": "UpdateReplacePolicyParam" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/intrinsic-deletion-policy.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/intrinsic-deletion-policy.json new file mode 100644 index 0000000000000..722ed175d0556 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/intrinsic-deletion-policy.json @@ -0,0 +1,53 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Transform": "AWS::LanguageExtensions", + "Parameters": { + "Stage": { + "Type": "String", + "AllowedValues": [ + "Prod", + "Staging", + "Dev" + ] + } + }, + "Conditions": { + "IsProd": { + "Fn::Equals": [ + { + "Ref": "Stage" + }, + "Prod" + ] + } + }, + "Resources": { + "Table": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [{ + "AttributeName": "primaryKey", + "KeyType": "HASH" + }], + "AttributeDefinitions": [{ + "AttributeName": "primaryKey", + "AttributeType": "S" + }] + }, + "DeletionPolicy": { + "Fn::If": [ + "IsProd", + "Retain", + "Delete" + ] + }, + "UpdateReplacePolicy": { + "Fn::If": [ + "IsProd", + "Retain", + "Delete" + ] + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts b/packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts index b6ff1bea6f681..e27c9bb3ebc17 100644 --- a/packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts +++ b/packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts @@ -262,6 +262,22 @@ describe('CDK Include', () => { ); }); + test('can ingest a template with fn:: intrinsic function used in deletion policy', () => { + includeTestTemplate(stack, 'intrinsic-deletion-policy.json'); + + Template.fromStack(stack).templateMatches( + loadTestFileToJsObject('intrinsic-deletion-policy.json'), + ); + }); + + test('can ingest a template with ref intrinsic functions used in deletion policy', () => { + includeTestTemplate(stack, 'intrinsic-deletion-policy-ref.json'); + + Template.fromStack(stack).templateMatches( + loadTestFileToJsObject('intrinsic-deletion-policy-ref.json'), + ); + }); + test('can ingest a JSON template with string-form Fn::GetAtt, and output it unchanged', () => { includeTestTemplate(stack, 'get-att-string-form.json'); diff --git a/packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts b/packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts index 4b7fd0cbb30a4..2dce8dad956e9 100644 --- a/packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts +++ b/packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts @@ -466,14 +466,21 @@ export class CfnParser { } private parseDeletionPolicy(policy: any): CfnDeletionPolicy | undefined { + if (policy === undefined || policy === null) { + return undefined; + } + const isIntrinsic = this.looksLikeCfnIntrinsic(policy); switch (policy) { - case null: return undefined; - case undefined: return undefined; case 'Delete': return CfnDeletionPolicy.DELETE; case 'Retain': return CfnDeletionPolicy.RETAIN; case 'Snapshot': return CfnDeletionPolicy.SNAPSHOT; case 'RetainExceptOnCreate': return CfnDeletionPolicy.RETAIN_EXCEPT_ON_CREATE; - default: throw new Error(`Unrecognized DeletionPolicy '${policy}'`); + default: if (isIntrinsic) { + policy = this.parseValue(policy); + return policy; + } else { + throw new Error(`Unrecognized DeletionPolicy '${policy}'`); + } } } diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md index 95817e6176cb4..6ba99522b8f73 100644 --- a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -63,6 +63,7 @@ Flags come in three types: | [@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters](#aws-cdkaws-rdsauroraclusterchangescopeofinstanceparametergroupwitheachparameters) | When enabled, a scope of InstanceParameterGroup for AuroraClusterInstance with each parameters will change. | 2.97.0 | (fix) | | [@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials](#aws-cdkaws-rdspreventrenderingdeprecatedcredentials) | When enabled, creating an RDS database cluster from a snapshot will only render credentials for snapshot credentials. | 2.98.0 | (fix) | | [@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource](#aws-cdkaws-codepipeline-actionsusenewdefaultbranchforcodecommitsource) | When enabled, the CodeCommit source action is using the default branch name 'main'. | 2.103.1 | (fix) | +| [@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction](#aws-cdkaws-cloudwatch-actionschangelambdapermissionlogicalidforlambdaaction) | When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID. | V2NEXT | (fix) | @@ -116,7 +117,8 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true, "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true, "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true, - "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true + "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true, + "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true } } ``` @@ -1193,4 +1195,22 @@ However, with the activation of this feature flag, the default branch is updated | 2.103.1 | `false` | `true` | +### @aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction + +*When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID.* (fix) + +When this feature flag is enabled, a logical ID of `LambdaPermission` for a +`LambdaAction` will include an alarm ID. Therefore multiple alarms for the same Lambda +can be created with `LambdaAction`. + +If the flag is set to false then it can only make one alarm for the Lambda with +`LambdaAction`. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| V2NEXT | `false` | `true` | + + diff --git a/packages/aws-cdk-lib/cx-api/README.md b/packages/aws-cdk-lib/cx-api/README.md index f25b78a5e6a26..82cf2e1596eeb 100644 --- a/packages/aws-cdk-lib/cx-api/README.md +++ b/packages/aws-cdk-lib/cx-api/README.md @@ -241,3 +241,20 @@ _cdk.json_ } } ``` + +* `@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction` + +Enable this feature flag to change the logical ID of the `LambdaPermission` for the `LambdaAction` to include an alarm ID. + +Previously, only one alarm with the `LambdaAction` could be created per Lambda. +This flag allows multiple alarms with the `LambdaAction` for the same Lambda to be created. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true + } +} +``` diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index b164badc1f9ba..e3e5ba30b552a 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -97,6 +97,7 @@ export const RDS_PREVENT_RENDERING_DEPRECATED_CREDENTIALS = '@aws-cdk/aws-rds:pr export const AURORA_CLUSTER_CHANGE_SCOPE_OF_INSTANCE_PARAMETER_GROUP_WITH_EACH_PARAMETERS = '@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters'; export const APPSYNC_ENABLE_USE_ARN_IDENTIFIER_SOURCE_API_ASSOCIATION = '@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier'; export const CODECOMMIT_SOURCE_ACTION_DEFAULT_BRANCH_NAME = '@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource'; +export const LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION = '@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction'; export const FLAGS: Record = { ////////////////////////////////////////////////////////////////////// @@ -976,6 +977,22 @@ export const FLAGS: Record = { introducedIn: { v2: '2.103.1' }, recommendedValue: true, }, + + ////////////////////////////////////////////////////////////////////// + [LAMBDA_PERMISSION_LOGICAL_ID_FOR_LAMBDA_ACTION]: { + type: FlagType.BugFix, + summary: 'When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID.', + detailsMd: ` + When this feature flag is enabled, a logical ID of \`LambdaPermission\` for a + \`LambdaAction\` will include an alarm ID. Therefore multiple alarms for the same Lambda + can be created with \`LambdaAction\`. + + If the flag is set to false then it can only make one alarm for the Lambda with + \`LambdaAction\`. + `, + introducedIn: { v2: 'V2NEXT' }, + recommendedValue: true, + }, }; const CURRENT_MV = 'v2'; diff --git a/version.v2.json b/version.v2.json index 521c3d6d0fe23..c4245379311aa 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.122.0", - "alphaVersion": "2.122.0-alpha.0" + "version": "2.123.0", + "alphaVersion": "2.123.0-alpha.0" } \ No newline at end of file