Skip to content

Commit

Permalink
chore(msk): integ test for batch associate scram secrets custom resou…
Browse files Browse the repository at this point in the history
…rce (#27106)

Adding an integ test for this custom resource with our new rule that each custom resource needs at least one integ test. This integ test is asserting that one scram secret per user is being registered with the cluster when SASL/SCRAM authentication is used.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
colifran authored Sep 12, 2023
1 parent b0a19c4 commit 444cc7d
Show file tree
Hide file tree
Showing 11 changed files with 35,808 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "34.0.0",
"files": {
"f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971": {
"source": {
"path": "asset.f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"682d551e1f3e9c334aa63f6e65d8c8664e858c7e2ee548f14642243842564a3a": {
"source": {
"path": "ScramSecretIntegTestDefaultTestDeployAssert4206AED8.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "682d551e1f3e9c334aa63f6e65d8c8664e858c7e2ee548f14642243842564a3a.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"Resources": {
"AwsApiCallKafkalistScramSecrets99a2254ce6c3e412ea0555d481633181": {
"Type": "Custom::DeployAssert@SdkCallKafkalistScramSecrets",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F",
"Arn"
]
},
"service": "Kafka",
"api": "listScramSecrets",
"expected": {
"Fn::Join": [
"",
[
"{\"$ObjectLike\":{\"SecretArnList\":[{\"$StringLike\":\"arn:aws:secretsmanager:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":secret:AmazonMSK_integ-test_integ-user-1-.*\"},{\"$StringLike\":\"arn:aws:secretsmanager:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":secret:AmazonMSK_integ-test_integ-user-2-.*\"}]}}"
]
]
},
"parameters": {
"ClusterArn": {
"Fn::Join": [
"",
[
"\"",
{
"Fn::ImportValue": "ScramSecretTestStack:ExportsOutputRefClusterEB0386A796A0E3FE"
},
"\""
]
]
}
},
"flattenResponse": "false",
"salt": "1694491911380"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
},
"ManagedPolicyArns": [
{
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
],
"Policies": [
{
"PolicyName": "Inline",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"kafka:ListScramSecrets"
],
"Effect": "Allow",
"Resource": [
"*"
]
}
]
}
}
]
}
},
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Runtime": "nodejs18.x",
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "f9eeaca5689691166106a01e96cb24972dd459c0e44c46f71d5a71a351954971.zip"
},
"Timeout": 120,
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
"Arn"
]
}
}
}
},
"Outputs": {
"AssertionResultsAwsApiCallKafkalistScramSecrets99a2254ce6c3e412ea0555d481633181": {
"Value": {
"Fn::GetAtt": [
"AwsApiCallKafkalistScramSecrets99a2254ce6c3e412ea0555d481633181",
"assertion"
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"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."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "34.0.0",
"files": {
"03adb2514e02907e0458bec59283658ec529425bd5df38e1194455c65dedf6ff": {
"source": {
"path": "asset.03adb2514e02907e0458bec59283658ec529425bd5df38e1194455c65dedf6ff",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "03adb2514e02907e0458bec59283658ec529425bd5df38e1194455c65dedf6ff.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"340d34ae293db2d97138557b50edeffe7434c285ff7310724b44a7c720b797f6": {
"source": {
"path": "ScramSecretTestStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "340d34ae293db2d97138557b50edeffe7434c285ff7310724b44a7c720b797f6.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading

0 comments on commit 444cc7d

Please sign in to comment.