diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts b/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts index 9bcbdf8ae2d5b..efe3080acf3fa 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts +++ b/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts @@ -1,5 +1,6 @@ import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, Stack, StackProps, RemovalPolicy } from '@aws-cdk/core'; +import { App, Stack, StackProps, RemovalPolicy, CfnResource } from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import * as opensearch from '../lib'; @@ -7,6 +8,14 @@ class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); + const serviceLinkedRole = new CfnResource(this, 'ServiceLinkedRole', { + type: 'AWS::IAM::ServiceLinkedRole', + properties: { + AWSServiceName: 'opensearchservice.amazonaws.com', + Description: 'Role for OpenSearch VPC Test', + }, + }); + const vpc = new ec2.Vpc(this, 'Vpc'); const domainProps: opensearch.DomainProps = { version: opensearch.EngineVersion.ELASTICSEARCH_7_1, @@ -19,10 +28,15 @@ class TestStack extends Stack { dataNodes: 2, }, }; - new opensearch.Domain(this, 'Domain', domainProps); + + const domain = new opensearch.Domain(this, 'Domain', domainProps); + domain.node.addDependency(serviceLinkedRole); } } const app = new App(); -new TestStack(app, 'cdk-integ-opensearch-vpc'); +const testCase = new TestStack(app, 'cdk-integ-opensearch-vpc'); +new integ.IntegTest(app, 'cdk-integ-opensearch-vpc-test', { + testCases: [testCase], +}); app.synth(); diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json index cfb61b56e1d9c..9afc775473ee1 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json @@ -1,5 +1,12 @@ { "Resources": { + "ServiceLinkedRole": { + "Type": "AWS::IAM::ServiceLinkedRole", + "Properties": { + "AWSServiceName": "opensearchservice.amazonaws.com", + "Description": "Role for OpenSearch VPC Test" + } + }, "Vpc8378EB38": { "Type": "AWS::EC2::VPC", "Properties": { @@ -397,7 +404,10 @@ "VpcId": { "Ref": "Vpc8378EB38" } - } + }, + "DependsOn": [ + "ServiceLinkedRole" + ] }, "Domain66AC69E0": { "Type": "AWS::OpenSearchService::Domain", @@ -447,6 +457,9 @@ ] } }, + "DependsOn": [ + "ServiceLinkedRole" + ], "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" } diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/integ.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/integ.json index 84a3ff6f21aee..3f1c0f0bb9569 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.opensearch.vpc": { + "cdk-integ-opensearch-vpc-test/DefaultTest": { "stacks": [ "cdk-integ-opensearch-vpc" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json index 7984c610349ba..2a2689d1d586f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json @@ -15,6 +15,12 @@ "validateOnSynth": false }, "metadata": { + "/cdk-integ-opensearch-vpc/ServiceLinkedRole": [ + { + "type": "aws:cdk:logicalId", + "data": "ServiceLinkedRole" + } + ], "/cdk-integ-opensearch-vpc/Vpc/Resource": [ { "type": "aws:cdk:logicalId", @@ -167,6 +173,15 @@ ] }, "displayName": "cdk-integ-opensearch-vpc" + }, + "cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json", + "validateOnSynth": false + }, + "displayName": "cdk-integ-opensearch-vpc-test/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json index d56fce1ae57b9..3addd38014aca 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json @@ -9,13 +9,21 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.58" + "version": "10.1.71" } }, "cdk-integ-opensearch-vpc": { "id": "cdk-integ-opensearch-vpc", "path": "cdk-integ-opensearch-vpc", "children": { + "ServiceLinkedRole": { + "id": "ServiceLinkedRole", + "path": "cdk-integ-opensearch-vpc/ServiceLinkedRole", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, "Vpc": { "id": "Vpc", "path": "cdk-integ-opensearch-vpc/Vpc", @@ -765,6 +773,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "cdk-integ-opensearch-vpc-test": { + "id": "cdk-integ-opensearch-vpc-test", + "path": "cdk-integ-opensearch-vpc-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "cdk-integ-opensearch-vpc-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "cdk-integ-opensearch-vpc-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.71" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "cdk-integ-opensearch-vpc-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": {