From d137d340dd5562ab24aeb9cfdfe7eda9ddc268d1 Mon Sep 17 00:00:00 2001 From: Jonathan Colbert Date: Thu, 10 Oct 2024 19:10:31 -0400 Subject: [PATCH] update integ test to destroy kms key --- ...efaultTestDeployAssertBBE0A609.assets.json | 2 +- .../cdk.out | 2 +- ...integ-cluster-managed-password.assets.json | 6 +- ...teg-cluster-managed-password.template.json | 48 ++------------ .../integ.json | 2 +- .../manifest.json | 36 +++++++---- .../tree.json | 64 +++---------------- .../test/integ.cluster-managed-password.ts | 12 ++-- 8 files changed, 50 insertions(+), 122 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/IntegClusterManagedPasswordTestDefaultTestDeployAssertBBE0A609.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/IntegClusterManagedPasswordTestDefaultTestDeployAssertBBE0A609.assets.json index dc8550afd0643..75e43fd5961eb 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/IntegClusterManagedPasswordTestDefaultTestDeployAssertBBE0A609.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/IntegClusterManagedPasswordTestDefaultTestDeployAssertBBE0A609.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/cdk.out index 1f0068d32659a..c6e612584e352 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.assets.json index a36c06d614155..bfe59ae8529fe 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { - "bc1049163692b8c2e35a91b78007b73b49e01d5ebdaac43c7254ce0840391042": { + "d4aaf3608e018bb6166b46ed1f78238b9566b90401b1d6375127863b0725ec53": { "source": { "path": "integ-cluster-managed-password.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "bc1049163692b8c2e35a91b78007b73b49e01d5ebdaac43c7254ce0840391042.json", + "objectKey": "d4aaf3608e018bb6166b46ed1f78238b9566b90401b1d6375127863b0725ec53.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.template.json index 5f461e272fa14..7309181ea8d83 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ-cluster-managed-password.template.json @@ -195,42 +195,6 @@ "VPCVPCGW99B986DC" ] }, - "VPCPublicSubnet2EIP4947BC00": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "integ-cluster-managed-password/VPC/PublicSubnet2" - } - ] - } - }, - "VPCPublicSubnet2NATGateway3C070193": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "VPCPublicSubnet2EIP4947BC00", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "VPCPublicSubnet2Subnet74179F39" - }, - "Tags": [ - { - "Key": "Name", - "Value": "integ-cluster-managed-password/VPC/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "VPCPublicSubnet2DefaultRouteB7481BBA", - "VPCPublicSubnet2RouteTableAssociation5A808732" - ] - }, "VPCPrivateSubnet1Subnet8BCA10E0": { "Type": "AWS::EC2::Subnet", "Properties": { @@ -362,7 +326,7 @@ "Properties": { "DestinationCidrBlock": "0.0.0.0/0", "NatGatewayId": { - "Ref": "VPCPublicSubnet2NATGateway3C070193" + "Ref": "VPCPublicSubnet1NATGatewayE0556630" }, "RouteTableId": { "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" @@ -423,8 +387,8 @@ "Version": "2012-10-17" } }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" }, "DatabaseSubnets56F17B9A": { "Type": "AWS::RDS::DBSubnetGroup", @@ -500,10 +464,6 @@ }, "MasterUsername": "testMasterUsername", "Port": 5432, - "ServerlessV2ScalingConfiguration": { - "MaxCapacity": 2, - "MinCapacity": 0.5 - }, "VpcSecurityGroupIds": [ { "Fn::GetAtt": [ @@ -522,7 +482,7 @@ "DBClusterIdentifier": { "Ref": "DatabaseB269D8BB" }, - "DBInstanceClass": "db.serverless", + "DBInstanceClass": "db.t4g.medium", "Engine": "aurora-postgresql", "PromotionTier": 0, "PubliclyAccessible": true diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ.json index b96b184a49d94..81ef43d7e2118 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "IntegClusterManagedPasswordTest/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/manifest.json index 21afa480613ca..8de4701f8d4d1 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "integ-cluster-managed-password.assets": { "type": "cdk:asset-manifest", @@ -16,9 +16,10 @@ "templateFile": "integ-cluster-managed-password.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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}/bc1049163692b8c2e35a91b78007b73b49e01d5ebdaac43c7254ce0840391042.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d4aaf3608e018bb6166b46ed1f78238b9566b90401b1d6375127863b0725ec53.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -100,18 +101,6 @@ "data": "VPCPublicSubnet2DefaultRouteB7481BBA" } ], - "/integ-cluster-managed-password/VPC/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCPublicSubnet2EIP4947BC00" - } - ], - "/integ-cluster-managed-password/VPC/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCPublicSubnet2NATGateway3C070193" - } - ], "/integ-cluster-managed-password/VPC/PrivateSubnet1/Subnet": [ { "type": "aws:cdk:logicalId", @@ -219,6 +208,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "VPCPublicSubnet2EIP4947BC00": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2EIP4947BC00", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "VPCPublicSubnet2NATGateway3C070193": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2NATGateway3C070193", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "integ-cluster-managed-password" @@ -238,6 +245,7 @@ "templateFile": "IntegClusterManagedPasswordTestDefaultTestDeployAssertBBE0A609.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/tree.json index ab7895cd6ee71..6cebbe6d7e83d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.js.snapshot/tree.json @@ -314,54 +314,6 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", "version": "0.0.0" } - }, - "EIP": { - "id": "EIP", - "path": "integ-cluster-managed-password/VPC/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "integ-cluster-managed-password/VPC/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "integ-cluster-managed-password/VPC/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "allocationId": { - "Fn::GetAtt": [ - "VPCPublicSubnet2EIP4947BC00", - "AllocationId" - ] - }, - "subnetId": { - "Ref": "VPCPublicSubnet2Subnet74179F39" - }, - "tags": [ - { - "key": "Name", - "value": "integ-cluster-managed-password/VPC/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", - "version": "0.0.0" - } } }, "constructInfo": { @@ -589,7 +541,7 @@ "aws:cdk:cloudformation:props": { "destinationCidrBlock": "0.0.0.0/0", "natGatewayId": { - "Ref": "VPCPublicSubnet2NATGateway3C070193" + "Ref": "VPCPublicSubnet1NATGatewayE0556630" }, "routeTableId": { "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" @@ -835,10 +787,6 @@ } }, "port": 5432, - "serverlessV2ScalingConfiguration": { - "minCapacity": 0.5, - "maxCapacity": 2 - }, "vpcSecurityGroupIds": [ { "Fn::GetAtt": [ @@ -854,6 +802,14 @@ "version": "0.0.0" } }, + "DbClusterSecret": { + "id": "DbClusterSecret", + "path": "integ-cluster-managed-password/Database/DbClusterSecret", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, "writer": { "id": "writer", "path": "integ-cluster-managed-password/Database/writer", @@ -867,7 +823,7 @@ "dbClusterIdentifier": { "Ref": "DatabaseB269D8BB" }, - "dbInstanceClass": "db.serverless", + "dbInstanceClass": "db.t4g.medium", "engine": "aurora-postgresql", "promotionTier": 0, "publiclyAccessible": true diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.ts index 8e6ccb786a531..7327454d74af9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-managed-password.ts @@ -7,9 +7,11 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { super(scope, id, props); - const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2, restrictDefaultSecurityGroup: false }); + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2, restrictDefaultSecurityGroup: false, natGateways: 1 }); - const kmsKey = new kms.Key(this, 'DbSecurity'); + const kmsKey = new kms.Key(this, 'DbSecurity', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); const cluster = new DatabaseCluster(this, 'Database', { engine: DatabaseClusterEngine.auroraPostgres({ @@ -19,11 +21,13 @@ class TestStack extends cdk.Stack { manageMasterUserPassword: true, vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, vpc, - writer: ClusterInstance.serverlessV2('writer'), + writer: ClusterInstance.provisioned('writer', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.MEDIUM), + }), + removalPolicy: cdk.RemovalPolicy.DESTROY, }); cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); - } }