From fbcb732ed5224d2ad5a8218229762efa13db689e Mon Sep 17 00:00:00 2001 From: Michael Sambol Date: Fri, 7 Feb 2025 17:54:24 -0800 Subject: [PATCH] fix(msk): allow both sasl/scram and iam auth (#31743) Pointed out [here](https://github.com/aws/aws-cdk/pull/14647#issuecomment-2129517358) and verified in the Console, both `SASL/SCRAM` and `IAM` can be enabled together. Closes #32779 It's a little confusing because [CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-msk-cluster-sasl.html) groups `Iam` and `Scram` together under `Sasl`, but the Console separates the two and allows both at the same time. I'd like to refactor this further but this change unblocks the issue where `SASL/SCRAM` and `IAM` cannot be enabled together. ![image](https://github.com/user-attachments/assets/60dd662e-4db9-4bbb-bcc0-67bd059f6870) --- packages/@aws-cdk/aws-msk-alpha/README.md | 2 +- .../@aws-cdk/aws-msk-alpha/lib/cluster.ts | 85 +- .../test/__snapshots__/cluster.test.ts.snap | 88 +- .../aws-msk-alpha/test/cluster.test.ts | 159 ++- ...efaultTestDeployAssert1991B19C.assets.json | 19 + ...aultTestDeployAssert1991B19C.template.json | 36 + .../aws-cdk-msk-auth-integ.assets.json | 19 + .../aws-cdk-msk-auth-integ.template.json | 670 ++++++++++ .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 297 +++++ .../tree.json | 1073 +++++++++++++++++ .../test/integ.cluster-authentication.ts | 78 ++ 13 files changed, 2449 insertions(+), 90 deletions(-) create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.assets.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.template.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.assets.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.template.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/integ.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/tree.json create mode 100644 packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.ts diff --git a/packages/@aws-cdk/aws-msk-alpha/README.md b/packages/@aws-cdk/aws-msk-alpha/README.md index 49a00ff89f407..a162ed16ddbc8 100644 --- a/packages/@aws-cdk/aws-msk-alpha/README.md +++ b/packages/@aws-cdk/aws-msk-alpha/README.md @@ -124,7 +124,7 @@ const cluster = new msk.Cluster(this, 'cluster', { }); ``` -### SASL/IAM +### IAM Enable client authentication with [IAM](https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html): diff --git a/packages/@aws-cdk/aws-msk-alpha/lib/cluster.ts b/packages/@aws-cdk/aws-msk-alpha/lib/cluster.ts index 14e5cfb3b3ff5..2abb98a7437ce 100644 --- a/packages/@aws-cdk/aws-msk-alpha/lib/cluster.ts +++ b/packages/@aws-cdk/aws-msk-alpha/lib/cluster.ts @@ -444,11 +444,7 @@ export class Cluster extends ClusterBase { /** * Reference an existing cluster, defined outside of the CDK code, by name. */ - public static fromClusterArn( - scope: constructs.Construct, - id: string, - clusterArn: string, - ): ICluster { + public static fromClusterArn(scope: constructs.Construct, id: string, clusterArn: string): ICluster { class Import extends ClusterBase { public readonly clusterArn = clusterArn; public readonly clusterName = core.Fn.select(1, core.Fn.split('/', clusterArn)); // ['arn:partition:kafka:region:account-id', clusterName, clusterId] @@ -465,9 +461,7 @@ export class Cluster extends ClusterBase { private _clusterBootstrapBrokers?: cr.AwsCustomResource; constructor(scope: constructs.Construct, id: string, props: ClusterProps) { - super(scope, id, { - physicalName: props.clusterName, - }); + super(scope, id, { physicalName: props.clusterName }); // Enhanced CDK Analytics Telemetry addConstructMetadata(this, props); @@ -483,26 +477,11 @@ export class Cluster extends ClusterBase { }); if (subnetSelection.subnets.length < 2) { - throw Error( - `Cluster requires at least 2 subnets, got ${subnetSelection.subnets.length}`, - ); + throw Error(`Cluster requires at least 2 subnets, got ${subnetSelection.subnets.length}`); } - if ( - props.clientAuthentication?.saslProps?.iam && - props.clientAuthentication?.saslProps?.scram - ) { - throw Error('Only one client authentication method can be enabled.'); - } - - if ( - props.encryptionInTransit?.clientBroker === - ClientBrokerEncryption.PLAINTEXT && - props.clientAuthentication - ) { - throw Error( - 'To enable client authentication, you must enabled TLS-encrypted traffic between clients and brokers.', - ); + if (props.encryptionInTransit?.clientBroker === ClientBrokerEncryption.PLAINTEXT && props.clientAuthentication) { + throw Error('To enable client authentication, you must enabled TLS-encrypted traffic between clients and brokers.'); } else if ( props.encryptionInTransit?.clientBroker === ClientBrokerEncryption.TLS_PLAINTEXT && @@ -514,13 +493,10 @@ export class Cluster extends ClusterBase { ); } - const volumeSize = - props.ebsStorageInfo?.volumeSize ?? 1000; + const volumeSize = props.ebsStorageInfo?.volumeSize ?? 1000; // Minimum: 1 GiB, maximum: 16384 GiB if (volumeSize < 1 || volumeSize > 16384) { - throw Error( - 'EBS volume size should be in the range 1-16384', - ); + throw Error('EBS volume size should be in the range 1-16384'); } const instanceType = props.instanceType @@ -642,13 +618,9 @@ export class Cluster extends ClusterBase { }, }; - if ( - props.clientAuthentication?.saslProps?.scram && - props.clientAuthentication?.saslProps?.key === undefined - ) { + if (props.clientAuthentication?.saslProps?.scram && props.clientAuthentication?.saslProps?.key === undefined) { this.saslScramAuthenticationKey = new kms.Key(this, 'SASLKey', { - description: - 'Used for encrypting MSK secrets for SASL/SCRAM authentication.', + description: 'Used for encrypting MSK secrets for SASL/SCRAM authentication.', alias: `msk/${props.clusterName}/sasl/scram`, }); @@ -678,37 +650,16 @@ export class Cluster extends ClusterBase { } let clientAuthentication: CfnCluster.ClientAuthenticationProperty | undefined; - if (props.clientAuthentication?.saslProps?.iam) { + if (props.clientAuthentication) { + const { saslProps, tlsProps } = props.clientAuthentication; clientAuthentication = { - sasl: { iam: { enabled: props.clientAuthentication.saslProps.iam } }, - }; - if (props.clientAuthentication?.tlsProps) { - clientAuthentication = { - sasl: { iam: { enabled: props.clientAuthentication.saslProps.iam } }, - tls: { - certificateAuthorityArnList: props.clientAuthentication?.tlsProps?.certificateAuthorities?.map( - (ca) => ca.certificateAuthorityArn, - ), - }, - }; - } - } else if (props.clientAuthentication?.saslProps?.scram) { - clientAuthentication = { - sasl: { - scram: { - enabled: props.clientAuthentication.saslProps.scram, - }, - }, - }; - } else if ( - props.clientAuthentication?.tlsProps?.certificateAuthorities !== undefined - ) { - clientAuthentication = { - tls: { - certificateAuthorityArnList: props.clientAuthentication?.tlsProps?.certificateAuthorities.map( - (ca) => ca.certificateAuthorityArn, - ), - }, + sasl: saslProps ? { + iam: saslProps.iam ? { enabled: true }: undefined, + scram: saslProps.scram ? { enabled: true }: undefined, + } : undefined, + tls: tlsProps?.certificateAuthorities ? { + certificateAuthorityArnList: tlsProps.certificateAuthorities?.map((ca) => ca.certificateAuthorityArn), + } : undefined, }; } diff --git a/packages/@aws-cdk/aws-msk-alpha/test/__snapshots__/cluster.test.ts.snap b/packages/@aws-cdk/aws-msk-alpha/test/__snapshots__/cluster.test.ts.snap index 8c5770b626607..87c70794105cb 100644 --- a/packages/@aws-cdk/aws-msk-alpha/test/__snapshots__/cluster.test.ts.snap +++ b/packages/@aws-cdk/aws-msk-alpha/test/__snapshots__/cluster.test.ts.snap @@ -493,7 +493,7 @@ exports[`MSK Cluster Snapshot test with all values set 1`] = ` } `; -exports[`MSK Cluster created with authentication enabled with sasl/iam auth and tls Snapshot test with all values set (iam/sasl) 1`] = ` +exports[`MSK Cluster created with authentication enabled with combinations of sasl/scram, iam, and tls Snapshot test with all values set (iam/scram/tls) 1`] = ` { "Resources": { "Vpc8378EB38": { @@ -915,6 +915,9 @@ exports[`MSK Cluster created with authentication enabled with sasl/iam auth and "Iam": { "Enabled": true, }, + "Scram": { + "Enabled": true, + }, }, "Tls": { "CertificateAuthorityArnList": [ @@ -965,6 +968,89 @@ exports[`MSK Cluster created with authentication enabled with sasl/iam auth and "Type": "AWS::MSK::Cluster", "UpdateReplacePolicy": "Retain", }, + "kafkaSASLKey69FC3AFA": { + "DeletionPolicy": "Retain", + "Properties": { + "Description": "Used for encrypting MSK secrets for SASL/SCRAM authentication.", + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition", + }, + ":iam::", + { + "Ref": "AWS::AccountId", + }, + ":root", + ], + ], + }, + }, + "Resource": "*", + }, + { + "Action": [ + "kms:Encrypt", + "kms:Decrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*", + "kms:CreateGrant", + "kms:DescribeKey", + ], + "Condition": { + "StringEquals": { + "kms:CallerAccount": { + "Ref": "AWS::AccountId", + }, + "kms:ViaService": { + "Fn::Join": [ + "", + [ + "secretsmanager.", + { + "Ref": "AWS::Region", + }, + ".amazonaws.com", + ], + ], + }, + }, + }, + "Effect": "Allow", + "Principal": { + "AWS": "*", + }, + "Resource": "*", + "Sid": "Allow access through AWS Secrets Manager for all principals in the account that are authorized to use AWS Secrets Manager", + }, + ], + "Version": "2012-10-17", + }, + }, + "Type": "AWS::KMS::Key", + "UpdateReplacePolicy": "Retain", + }, + "kafkaSASLKeyAlias7A73E101": { + "Properties": { + "AliasName": "alias/msk/test-cluster/sasl/scram", + "TargetKeyId": { + "Fn::GetAtt": [ + "kafkaSASLKey69FC3AFA", + "Arn", + ], + }, + }, + "Type": "AWS::KMS::Alias", + }, "sg1fromsg32181E6F4C07E": { "Properties": { "Description": "from sg3:2181", diff --git a/packages/@aws-cdk/aws-msk-alpha/test/cluster.test.ts b/packages/@aws-cdk/aws-msk-alpha/test/cluster.test.ts index af79eabee06af..50ed3af98f67f 100644 --- a/packages/@aws-cdk/aws-msk-alpha/test/cluster.test.ts +++ b/packages/@aws-cdk/aws-msk-alpha/test/cluster.test.ts @@ -107,6 +107,33 @@ describe('MSK Cluster', () => { describe('created with authentication enabled', () => { describe('with tls auth', () => { + test('tls enabled is true', () => { + new msk.Cluster(stack, 'Cluster', { + clusterName: 'cluster', + kafkaVersion: msk.KafkaVersion.V2_6_1, + vpc, + encryptionInTransit: { + clientBroker: msk.ClientBrokerEncryption.TLS, + }, + clientAuthentication: msk.ClientAuthentication.tls({ + certificateAuthorities: [ + acmpca.CertificateAuthority.fromCertificateAuthorityArn( + stack, + 'CertificateAuthority', + 'arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/11111111-1111-1111-1111-111111111111', + ), + ], + }), + }); + Template.fromStack(stack).hasResourceProperties('AWS::MSK::Cluster', { + ClientAuthentication: { + Tls: { + CertificateAuthorityArnList: ['arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/11111111-1111-1111-1111-111111111111'], + }, + }, + }); + }); + test('fails if client broker encryption is set to plaintext', () => { expect( () => @@ -134,6 +161,27 @@ describe('MSK Cluster', () => { }); describe('with sasl/scram auth', () => { + test('sasl/scram enabled is true', () => { + new msk.Cluster(stack, 'Cluster', { + clusterName: 'cluster', + kafkaVersion: msk.KafkaVersion.V2_6_1, + vpc, + encryptionInTransit: { + clientBroker: msk.ClientBrokerEncryption.TLS, + }, + clientAuthentication: msk.ClientAuthentication.sasl({ + scram: true, + }), + }); + Template.fromStack(stack).hasResourceProperties('AWS::MSK::Cluster', { + ClientAuthentication: { + Sasl: { + Scram: { Enabled: true }, + }, + }, + }); + }); + test('fails if tls encryption is set to plaintext', () => { expect(() => new msk.Cluster(stack, 'Cluster', { clusterName: 'cluster', @@ -171,7 +219,7 @@ describe('MSK Cluster', () => { }); }); - describe('with sasl/iam auth', () => { + describe('with iam auth', () => { test('iam enabled is true', () => { new msk.Cluster(stack, 'Cluster', { clusterName: 'cluster', @@ -190,6 +238,7 @@ describe('MSK Cluster', () => { }, }); }); + test('fails if tls encryption is set to plaintext', () => { expect( () => @@ -229,8 +278,93 @@ describe('MSK Cluster', () => { }); }); - describe('with sasl/iam auth and tls', () => { - test('Snapshot test with all values set (iam/sasl)', () => { + describe('with combinations of sasl/scram, iam, and tls', () => { + test('sasl/scram and iam enabled is true', () => { + new msk.Cluster(stack, 'Cluster', { + clusterName: 'cluster', + kafkaVersion: msk.KafkaVersion.V2_6_1, + vpc, + encryptionInTransit: { + clientBroker: msk.ClientBrokerEncryption.TLS, + }, + clientAuthentication: msk.ClientAuthentication.sasl({ + iam: true, + scram: true, + }), + }); + Template.fromStack(stack).hasResourceProperties('AWS::MSK::Cluster', { + ClientAuthentication: { + Sasl: { + Iam: { Enabled: true }, + Scram: { Enabled: true }, + }, + }, + }); + }); + + test('sasl/scram and tls enabled is true', () => { + new msk.Cluster(stack, 'Cluster', { + clusterName: 'cluster', + kafkaVersion: msk.KafkaVersion.V2_6_1, + vpc, + encryptionInTransit: { + clientBroker: msk.ClientBrokerEncryption.TLS, + }, + clientAuthentication: msk.ClientAuthentication.saslTls({ + scram: true, + certificateAuthorities: [ + acmpca.CertificateAuthority.fromCertificateAuthorityArn( + stack, + 'CertificateAuthority', + 'arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/11111111-1111-1111-1111-111111111111', + ), + ], + }), + }); + Template.fromStack(stack).hasResourceProperties('AWS::MSK::Cluster', { + ClientAuthentication: { + Sasl: { + Scram: { Enabled: true }, + }, + Tls: { + CertificateAuthorityArnList: ['arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/11111111-1111-1111-1111-111111111111'], + }, + }, + }); + }); + + test('iam and tls enabled is true', () => { + new msk.Cluster(stack, 'Cluster', { + clusterName: 'cluster', + kafkaVersion: msk.KafkaVersion.V2_6_1, + vpc, + encryptionInTransit: { + clientBroker: msk.ClientBrokerEncryption.TLS, + }, + clientAuthentication: msk.ClientAuthentication.saslTls({ + iam: true, + certificateAuthorities: [ + acmpca.CertificateAuthority.fromCertificateAuthorityArn( + stack, + 'CertificateAuthority', + 'arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/11111111-1111-1111-1111-111111111111', + ), + ], + }), + }); + Template.fromStack(stack).hasResourceProperties('AWS::MSK::Cluster', { + ClientAuthentication: { + Sasl: { + Iam: { Enabled: true }, + }, + Tls: { + CertificateAuthorityArnList: ['arn:aws:acm-pca:us-west-2:1234567890:certificate-authority/11111111-1111-1111-1111-111111111111'], + }, + }, + }); + }); + + test('Snapshot test with all values set (iam/scram/tls)', () => { const cluster = new msk.Cluster(stack, 'kafka', { clusterName: 'test-cluster', kafkaVersion: msk.KafkaVersion.V2_6_1, @@ -252,6 +386,7 @@ describe('MSK Cluster', () => { }, clientAuthentication: msk.ClientAuthentication.saslTls({ iam: true, + scram: true, certificateAuthorities: [ acmpca.CertificateAuthority.fromCertificateAuthorityArn( stack, @@ -375,24 +510,6 @@ describe('MSK Cluster', () => { }); }); }); - - test('fails if more than one authentication method is enabled', () => { - expect( - () => - new msk.Cluster(stack, 'Cluster', { - clusterName: 'cluster', - kafkaVersion: msk.KafkaVersion.V2_6_1, - vpc, - encryptionInTransit: { - clientBroker: msk.ClientBrokerEncryption.TLS, - }, - clientAuthentication: msk.ClientAuthentication.sasl({ - iam: true, - scram: true, - }), - }), - ).toThrow('Only one client authentication method can be enabled.'); - }); }); describe('created with an instance type set', () => { diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.assets.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.assets.json new file mode 100644 index 0000000000000..f873f00421c06 --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "MskClusterAuthDefaultTestDeployAssert1991B19C.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.template.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/MskClusterAuthDefaultTestDeployAssert1991B19C.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.assets.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.assets.json new file mode 100644 index 0000000000000..0c422f5e63102 --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "7c12b5b1fd96903b543fbfd848373b75380666868f6a835c113706d91d538e56": { + "source": { + "path": "aws-cdk-msk-auth-integ.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7c12b5b1fd96903b543fbfd848373b75380666868f6a835c113706d91d538e56.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-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.template.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.template.json new file mode 100644 index 0000000000000..5988ed149270c --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/aws-cdk-msk-auth-integ.template.json @@ -0,0 +1,670 @@ +{ + "Resources": { + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC" + } + ] + } + }, + "VPCPublicSubnet1SubnetB4246D30": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet1RouteTableFEE4B781": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet1RouteTableAssociation0B0896DC": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "VPCPublicSubnet1DefaultRoute91CEF279": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet1EIP6AD938E8": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1NATGatewayE0556630": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet1DefaultRoute91CEF279", + "VPCPublicSubnet1RouteTableAssociation0B0896DC" + ] + }, + "VPCPublicSubnet2Subnet74179F39": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet2RouteTable6F1A15F1": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPublicSubnet2RouteTableAssociation5A808732": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "VPCPublicSubnet2DefaultRouteB7481BBA": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet2EIP4947BC00": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2NATGateway3C070193": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet2DefaultRouteB7481BBA", + "VPCPublicSubnet2RouteTableAssociation5A808732" + ] + }, + "VPCPrivateSubnet1Subnet8BCA10E0": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet1RouteTableBE8A6027": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet1RouteTableAssociation347902D1": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "VPCPrivateSubnet1DefaultRouteAE1D6490": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + }, + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + } + } + }, + "VPCPrivateSubnet2SubnetCFCDAA7A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet2RouteTable0A19E10E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCPrivateSubnet2RouteTableAssociation0C73D413": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "VPCPrivateSubnet2DefaultRouteF4F5CFD2": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + }, + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + } + } + }, + "VPCIGWB7E252D3": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-msk-auth-integ/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "CertificateAuthority": { + "Type": "AWS::ACMPCA::CertificateAuthority", + "Properties": { + "KeyAlgorithm": "RSA_2048", + "KeyStorageSecurityStandard": "FIPS_140_2_LEVEL_3_OR_HIGHER", + "SigningAlgorithm": "SHA256WITHRSA", + "Subject": { + "CommonName": "MSK Cluster Root CA", + "Country": "DE", + "Locality": "Berlin", + "Organization": "Amazon Web Services", + "OrganizationalUnit": "AWS-CDK", + "State": "Berlin" + }, + "Type": "ROOT" + } + }, + "Certificate": { + "Type": "AWS::ACMPCA::Certificate", + "Properties": { + "CertificateAuthorityArn": { + "Fn::GetAtt": [ + "CertificateAuthority", + "Arn" + ] + }, + "CertificateSigningRequest": { + "Fn::GetAtt": [ + "CertificateAuthority", + "CertificateSigningRequest" + ] + }, + "SigningAlgorithm": "SHA256WITHRSA", + "TemplateArn": "arn:aws:acm-pca:::template/RootCACertificate/V1", + "Validity": { + "Type": "YEARS", + "Value": 1 + } + } + }, + "CertificateActivation": { + "Type": "AWS::ACMPCA::CertificateAuthorityActivation", + "Properties": { + "Certificate": { + "Fn::GetAtt": [ + "Certificate", + "Certificate" + ] + }, + "CertificateAuthorityArn": { + "Fn::GetAtt": [ + "CertificateAuthority", + "Arn" + ] + } + } + }, + "ClusterSecurityGroup0921994B": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "MSK security group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + }, + "DependsOn": [ + "CertificateActivation" + ] + }, + "ClusterSASLKeyC4AE65F3": { + "Type": "AWS::KMS::Key", + "Properties": { + "Description": "Used for encrypting MSK secrets for SASL/SCRAM authentication.", + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:CreateGrant", + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Condition": { + "StringEquals": { + "kms:ViaService": { + "Fn::Join": [ + "", + [ + "secretsmanager.", + { + "Ref": "AWS::Region" + }, + ".amazonaws.com" + ] + ] + }, + "kms:CallerAccount": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "AWS": "*" + }, + "Resource": "*", + "Sid": "Allow access through AWS Secrets Manager for all principals in the account that are authorized to use AWS Secrets Manager" + } + ], + "Version": "2012-10-17" + } + }, + "DependsOn": [ + "CertificateActivation" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "ClusterSASLKeyAliasCBD2665F": { + "Type": "AWS::KMS::Alias", + "Properties": { + "AliasName": "alias/msk/integ-test-auth/sasl/scram", + "TargetKeyId": { + "Fn::GetAtt": [ + "ClusterSASLKeyC4AE65F3", + "Arn" + ] + } + }, + "DependsOn": [ + "CertificateActivation" + ] + }, + "ClusterEB0386A7": { + "Type": "AWS::MSK::Cluster", + "Properties": { + "BrokerNodeGroupInfo": { + "ClientSubnets": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "InstanceType": "kafka.m5.large", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "ClusterSecurityGroup0921994B", + "GroupId" + ] + } + ], + "StorageInfo": { + "EBSStorageInfo": { + "VolumeSize": 1000 + } + } + }, + "ClientAuthentication": { + "Sasl": { + "Iam": { + "Enabled": true + }, + "Scram": { + "Enabled": true + } + }, + "Tls": { + "CertificateAuthorityArnList": [ + { + "Fn::GetAtt": [ + "CertificateAuthority", + "Arn" + ] + } + ] + } + }, + "ClusterName": "integ-test-auth", + "EncryptionInfo": { + "EncryptionInTransit": { + "ClientBroker": "TLS", + "InCluster": true + } + }, + "KafkaVersion": "3.6.0", + "LoggingInfo": { + "BrokerLogs": { + "CloudWatchLogs": { + "Enabled": false + }, + "Firehose": { + "Enabled": false + }, + "S3": { + "Enabled": false + } + } + }, + "NumberOfBrokerNodes": 2 + }, + "DependsOn": [ + "CertificateActivation" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "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/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/cdk.out b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/cdk.out new file mode 100644 index 0000000000000..c6e612584e352 --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/integ.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/integ.json new file mode 100644 index 0000000000000..8fabed5845680 --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "MskClusterAuth/DefaultTest": { + "stacks": [ + "aws-cdk-msk-auth-integ" + ], + "assertionStack": "MskClusterAuth/DefaultTest/DeployAssert", + "assertionStackName": "MskClusterAuthDefaultTestDeployAssert1991B19C" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/manifest.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/manifest.json new file mode 100644 index 0000000000000..e08440b3a070c --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/manifest.json @@ -0,0 +1,297 @@ +{ + "version": "38.0.1", + "artifacts": { + "aws-cdk-msk-auth-integ.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-msk-auth-integ.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-msk-auth-integ": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-msk-auth-integ.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}/7c12b5b1fd96903b543fbfd848373b75380666868f6a835c113706d91d538e56.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-msk-auth-integ.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": [ + "aws-cdk-msk-auth-integ.assets" + ], + "metadata": { + "/aws-cdk-msk-auth-integ/VPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCB9E5F0B4" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1SubnetB4246D30" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableFEE4B781" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableAssociation0B0896DC" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1DefaultRoute91CEF279" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1EIP6AD938E8" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1NATGatewayE0556630" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2Subnet74179F39" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTable6F1A15F1" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTableAssociation5A808732" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2DefaultRouteB7481BBA" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2EIP4947BC00" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2NATGateway3C070193" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1Subnet8BCA10E0" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableBE8A6027" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableAssociation347902D1" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1DefaultRouteAE1D6490" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTable0A19E10E" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTableAssociation0C73D413" + } + ], + "/aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2DefaultRouteF4F5CFD2" + } + ], + "/aws-cdk-msk-auth-integ/VPC/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCIGWB7E252D3" + } + ], + "/aws-cdk-msk-auth-integ/VPC/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCVPCGW99B986DC" + } + ], + "/aws-cdk-msk-auth-integ/CertificateAuthority": [ + { + "type": "aws:cdk:logicalId", + "data": "CertificateAuthority" + }, + { + "type": "Description", + "data": "Signing authority for Certificates" + } + ], + "/aws-cdk-msk-auth-integ/Certificate": [ + { + "type": "aws:cdk:logicalId", + "data": "Certificate" + }, + { + "type": "Description", + "data": "Certificate for signing requests from MSK-Cluster" + } + ], + "/aws-cdk-msk-auth-integ/CertificateActivation": [ + { + "type": "aws:cdk:logicalId", + "data": "CertificateActivation" + } + ], + "/aws-cdk-msk-auth-integ/Cluster/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSecurityGroup0921994B" + } + ], + "/aws-cdk-msk-auth-integ/Cluster/SASLKey/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSASLKeyC4AE65F3" + } + ], + "/aws-cdk-msk-auth-integ/Cluster/SASLKey/Alias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSASLKeyAliasCBD2665F" + } + ], + "/aws-cdk-msk-auth-integ/Cluster/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterEB0386A7" + } + ], + "/aws-cdk-msk-auth-integ/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-msk-auth-integ/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-msk-auth-integ" + }, + "MskClusterAuthDefaultTestDeployAssert1991B19C.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "MskClusterAuthDefaultTestDeployAssert1991B19C.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "MskClusterAuthDefaultTestDeployAssert1991B19C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "MskClusterAuthDefaultTestDeployAssert1991B19C.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "MskClusterAuthDefaultTestDeployAssert1991B19C.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": [ + "MskClusterAuthDefaultTestDeployAssert1991B19C.assets" + ], + "metadata": { + "/MskClusterAuth/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/MskClusterAuth/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "MskClusterAuth/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/tree.json b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/tree.json new file mode 100644 index 0000000000000..62d30dc4e3576 --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.js.snapshot/tree.json @@ -0,0 +1,1073 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-msk-auth-integ": { + "id": "aws-cdk-msk-auth-integ", + "path": "aws-cdk-msk-auth-integ", + "children": { + "VPC": { + "id": "VPC", + "path": "aws-cdk-msk-auth-integ/VPC", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-msk-auth-integ/VPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "aws-cdk-msk-auth-integ/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": "aws-cdk-msk-auth-integ/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + }, + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-cdk-msk-auth-integ/VPC/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + }, + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "aws-cdk-msk-auth-integ/VPC/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-cdk-msk-auth-integ/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "aws-cdk-msk-auth-integ/VPC/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "CertificateAuthority": { + "id": "CertificateAuthority", + "path": "aws-cdk-msk-auth-integ/CertificateAuthority", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ACMPCA::CertificateAuthority", + "aws:cdk:cloudformation:props": { + "keyAlgorithm": "RSA_2048", + "keyStorageSecurityStandard": "FIPS_140_2_LEVEL_3_OR_HIGHER", + "signingAlgorithm": "SHA256WITHRSA", + "subject": { + "commonName": "MSK Cluster Root CA", + "organization": "Amazon Web Services", + "organizationalUnit": "AWS-CDK", + "country": "DE", + "state": "Berlin", + "locality": "Berlin" + }, + "type": "ROOT" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_acmpca.CfnCertificateAuthority", + "version": "0.0.0" + } + }, + "Certificate": { + "id": "Certificate", + "path": "aws-cdk-msk-auth-integ/Certificate", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ACMPCA::Certificate", + "aws:cdk:cloudformation:props": { + "certificateAuthorityArn": { + "Fn::GetAtt": [ + "CertificateAuthority", + "Arn" + ] + }, + "certificateSigningRequest": { + "Fn::GetAtt": [ + "CertificateAuthority", + "CertificateSigningRequest" + ] + }, + "signingAlgorithm": "SHA256WITHRSA", + "templateArn": "arn:aws:acm-pca:::template/RootCACertificate/V1", + "validity": { + "type": "YEARS", + "value": 1 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_acmpca.CfnCertificate", + "version": "0.0.0" + } + }, + "CertificateActivation": { + "id": "CertificateActivation", + "path": "aws-cdk-msk-auth-integ/CertificateActivation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ACMPCA::CertificateAuthorityActivation", + "aws:cdk:cloudformation:props": { + "certificate": { + "Fn::GetAtt": [ + "Certificate", + "Certificate" + ] + }, + "certificateAuthorityArn": { + "Fn::GetAtt": [ + "CertificateAuthority", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_acmpca.CfnCertificateAuthorityActivation", + "version": "0.0.0" + } + }, + "PrivateCA": { + "id": "PrivateCA", + "path": "aws-cdk-msk-auth-integ/PrivateCA", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Cluster": { + "id": "Cluster", + "path": "aws-cdk-msk-auth-integ/Cluster", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "aws-cdk-msk-auth-integ/Cluster/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-msk-auth-integ/Cluster/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "MSK security group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "SASLKey": { + "id": "SASLKey", + "path": "aws-cdk-msk-auth-integ/Cluster/SASLKey", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-msk-auth-integ/Cluster/SASLKey/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "description": "Used for encrypting MSK secrets for SASL/SCRAM authentication.", + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:CreateGrant", + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Condition": { + "StringEquals": { + "kms:ViaService": { + "Fn::Join": [ + "", + [ + "secretsmanager.", + { + "Ref": "AWS::Region" + }, + ".amazonaws.com" + ] + ] + }, + "kms:CallerAccount": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "AWS": "*" + }, + "Resource": "*", + "Sid": "Allow access through AWS Secrets Manager for all principals in the account that are authorized to use AWS Secrets Manager" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "0.0.0" + } + }, + "Alias": { + "id": "Alias", + "path": "aws-cdk-msk-auth-integ/Cluster/SASLKey/Alias", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-msk-auth-integ/Cluster/SASLKey/Alias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Alias", + "aws:cdk:cloudformation:props": { + "aliasName": "alias/msk/integ-test-auth/sasl/scram", + "targetKeyId": { + "Fn::GetAtt": [ + "ClusterSASLKeyC4AE65F3", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Alias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-msk-auth-integ/Cluster/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::MSK::Cluster", + "aws:cdk:cloudformation:props": { + "brokerNodeGroupInfo": { + "instanceType": "kafka.m5.large", + "clientSubnets": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "securityGroups": [ + { + "Fn::GetAtt": [ + "ClusterSecurityGroup0921994B", + "GroupId" + ] + } + ], + "storageInfo": { + "ebsStorageInfo": { + "volumeSize": 1000 + } + } + }, + "clientAuthentication": { + "sasl": { + "iam": { + "enabled": true + }, + "scram": { + "enabled": true + } + }, + "tls": { + "certificateAuthorityArnList": [ + { + "Fn::GetAtt": [ + "CertificateAuthority", + "Arn" + ] + } + ] + } + }, + "clusterName": "integ-test-auth", + "encryptionInfo": { + "encryptionInTransit": { + "clientBroker": "TLS", + "inCluster": true + } + }, + "kafkaVersion": "3.6.0", + "loggingInfo": { + "brokerLogs": { + "cloudWatchLogs": { + "enabled": false + }, + "firehose": { + "enabled": false + }, + "s3": { + "enabled": false + } + } + }, + "numberOfBrokerNodes": 2 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_msk.CfnCluster", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-msk-auth-integ/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-msk-auth-integ/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "MskClusterAuth": { + "id": "MskClusterAuth", + "path": "MskClusterAuth", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "MskClusterAuth/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "MskClusterAuth/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "MskClusterAuth/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "MskClusterAuth/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "MskClusterAuth/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.ts b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.ts new file mode 100644 index 0000000000000..da4076f74a65b --- /dev/null +++ b/packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-authentication.ts @@ -0,0 +1,78 @@ +import { + CertificateAuthority, + CfnCertificate, + CfnCertificateAuthority, + CfnCertificateAuthorityActivation, +} from 'aws-cdk-lib/aws-acmpca'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as msk from '../lib'; + +const app = new cdk.App(); + +class MskClusterAuthTestStack 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 certSigningAlgorithm = 'SHA256WITHRSA'; + const privateCA = new CfnCertificateAuthority(this, 'CertificateAuthority', { + keyAlgorithm: 'RSA_2048', + signingAlgorithm: certSigningAlgorithm, + keyStorageSecurityStandard: 'FIPS_140_2_LEVEL_3_OR_HIGHER', + type: 'ROOT', + subject: { + commonName: 'MSK Cluster Root CA', + organization: 'Amazon Web Services', + organizationalUnit: 'AWS-CDK', + country: 'DE', + state: 'Berlin', + locality: 'Berlin', + }, + }); + + privateCA.node.addMetadata('Description', 'Signing authority for Certificates'); + + const cert = new CfnCertificate(this, 'Certificate', { + certificateAuthorityArn: privateCA.attrArn, + certificateSigningRequest: privateCA.attrCertificateSigningRequest, + signingAlgorithm: certSigningAlgorithm, + templateArn: 'arn:aws:acm-pca:::template/RootCACertificate/V1', + validity: { type: 'YEARS', value: 1 }, + }); + cert.node.addMetadata('Description', 'Certificate for signing requests from MSK-Cluster'); + + // Activating the certificate using the signing cert authority + const certActivation = new CfnCertificateAuthorityActivation(this, 'CertificateActivation', { + certificateAuthorityArn: privateCA.attrArn, + certificate: cert.attrCertificate, + }); + + // SASL/SCRAM, IAM, and TLS authenticated MSK cluster integ test + const cluster = new msk.Cluster(this, 'Cluster', { + clusterName: 'integ-test-auth', + kafkaVersion: msk.KafkaVersion.V3_6_0, + vpc, + encryptionInTransit: { + clientBroker: msk.ClientBrokerEncryption.TLS, + }, + clientAuthentication: msk.ClientAuthentication.saslTls({ + iam: true, + scram: true, + certificateAuthorities: [CertificateAuthority.fromCertificateAuthorityArn(this, 'PrivateCA', privateCA.attrArn)], + }), + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + + cluster.node.addDependency(certActivation); + } +} + +const stack = new MskClusterAuthTestStack(app, 'aws-cdk-msk-auth-integ'); + +new IntegTest(app, 'MskClusterAuth', { + testCases: [stack], +}); + +app.synth();