diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.assets.json b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.assets.json deleted file mode 100644 index 3675eae979c68..0000000000000 --- a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "20.0.0", - "files": { - "3e753375c435676d4f1afe519f250c3c15514b6ff2861291c7982c1340c00dc0": { - "source": { - "path": "aws-cdk-redshift-cluster-database.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "3e753375c435676d4f1afe519f250c3c15514b6ff2861291c7982c1340c00dc0.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.template.json b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.template.json index 4226ef674b0c7..635b7d3eec711 100644 --- a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.template.json +++ b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/aws-cdk-redshift-cluster-database.template.json @@ -1,5 +1,10 @@ { "Resources": { + "ElasticIPAddress": { + "Type": "AWS::EC2::EIP", + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, "Vpc8378EB38": { "Type": "AWS::EC2::VPC", "Properties": { @@ -525,7 +530,9 @@ "ClusterSubnetGroupName": { "Ref": "ClusterSubnetsDCFA5CB7" }, - "ElasticIp": "10.123.123.123", + "ElasticIp": { + "Ref": "ElasticIPAddress" + }, "Encrypted": true, "NumberOfNodes": 2, "PubliclyAccessible": true, diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.template.json b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/integ.json b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/integ.json index 5639cbe6d2e42..28141e09b2519 100644 --- a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.cluster-elasticip": { + "aws-cdk-redshift-elastic-ip-test/DefaultTest": { "stacks": [ "aws-cdk-redshift-cluster-database" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/manifest.json index f2492278051ec..723d13aa25357 100644 --- a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/manifest.json @@ -15,6 +15,12 @@ "validateOnSynth": false }, "metadata": { + "/aws-cdk-redshift-cluster-database/ElasticIPAddress": [ + { + "type": "aws:cdk:logicalId", + "data": "ElasticIPAddress" + } + ], "/aws-cdk-redshift-cluster-database/Vpc/Resource": [ { "type": "aws:cdk:logicalId", @@ -180,14 +186,20 @@ "/aws-cdk-redshift-cluster-database/Cluster/Resource": [ { "type": "aws:cdk:logicalId", - "data": "ClusterEB0386A7", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "ClusterEB0386A7" } ] }, "displayName": "aws-cdk-redshift-cluster-database" + }, + "awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.template.json", + "validateOnSynth": false + }, + "displayName": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/tree.json b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/tree.json index f5cbcd0e4de1b..eb12244a1b3cd 100644 --- a/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift/test/cluster-elasticip.integ.snapshot/tree.json @@ -9,13 +9,25 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.33" + "version": "10.1.71" } }, "aws-cdk-redshift-cluster-database": { "id": "aws-cdk-redshift-cluster-database", "path": "aws-cdk-redshift-cluster-database", "children": { + "ElasticIPAddress": { + "id": "ElasticIPAddress", + "path": "aws-cdk-redshift-cluster-database/ElasticIPAddress", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnEIP", + "version": "0.0.0" + } + }, "Vpc": { "id": "Vpc", "path": "aws-cdk-redshift-cluster-database/Vpc", @@ -826,7 +838,9 @@ "clusterSubnetGroupName": { "Ref": "ClusterSubnetsDCFA5CB7" }, - "elasticIp": "10.123.123.123", + "elasticIp": { + "Ref": "ElasticIPAddress" + }, "encrypted": true, "numberOfNodes": 2, "publiclyAccessible": true, @@ -856,6 +870,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "aws-cdk-redshift-elastic-ip-test": { + "id": "aws-cdk-redshift-elastic-ip-test", + "path": "aws-cdk-redshift-elastic-ip-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.71" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts index 75ec831a94e63..72c8f9cbc7a44 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts @@ -1,13 +1,12 @@ -#!/usr/bin/env node -/// !cdk-integ pragma:ignore-assets import * as ec2 from '@aws-cdk/aws-ec2'; import * as cdk from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; import * as constructs from 'constructs'; import * as redshift from '../lib'; const app = new cdk.App(); - const stack = new cdk.Stack(app, 'aws-cdk-redshift-cluster-database'); + cdk.Aspects.of(stack).add({ visit(node: constructs.IConstruct) { if (cdk.CfnResource.isCfnResource(node)) { @@ -16,6 +15,7 @@ cdk.Aspects.of(stack).add({ }, }); +const elasticIp = new ec2.CfnEIP(stack, 'ElasticIPAddress'); const vpc = new ec2.Vpc(stack, 'Vpc', { enableDnsHostnames: true, enableDnsSupport: true, @@ -29,7 +29,11 @@ new redshift.Cluster(stack, 'Cluster', { masterUsername: 'admin', }, publiclyAccessible: true, - elasticIp: '10.123.123.123', + elasticIp: elasticIp.ref, +}); + +new integ.IntegTest(app, 'aws-cdk-redshift-elastic-ip-test', { + testCases: [stack], }); app.synth();