From 4093afecd4211e0997bf780d1ba69e2ecf7c4f78 Mon Sep 17 00:00:00 2001 From: Daniel Matuki da Cunha Date: Wed, 19 May 2021 11:43:07 -0700 Subject: [PATCH] fix(aws-lambda-ssm-string-parameter): Code review fixes. --- .../test/lambda-dynamodb.test.ts | 2 +- .../aws-lambda-s3/test/lambda-s3.test.ts | 2 +- .../test/lambda-secretsmanager.test.ts | 8 +- .../aws-lambda-sns/test/lambda-sns.test.ts | 2 +- .../aws-lambda-sqs/test/lambda-sqs.test.ts | 2 +- .../lambda-ssm-string-parameter.test.js.snap | 234 ------------------ .../tsconfig.json | 38 --- .../.eslintignore | 0 .../.gitignore | 0 .../.npmignore | 0 .../README.md | 20 +- .../architecture.png | Bin .../lib/index.ts | 23 +- .../package.json | 4 +- .../test/integ.deployFunction.expected.json | 24 +- .../test/integ.deployFunction.ts | 10 +- ...eployFunctionWithExistingVpc.expected.json | 76 +++--- .../integ.deployFunctionWithExistingVpc.ts | 10 +- .../integ.deployFunctionWithVpc.expected.json | 50 ++-- .../test/integ.deployFunctionWithVpc.ts | 10 +- .../test/integ.existingFunction.expected.json | 8 +- .../test/integ.existingFunction.ts | 10 +- ...nteg.existingStringParameter.expected.json | 18 +- .../test/integ.existingStringParameter.ts | 10 +- .../test/lambda-ssmstringparameter.test.ts} | 54 ++-- .../test/lambda/index.js | 0 .../@aws-solutions-constructs/core/index.ts | 2 +- ...lper.ts => ssm-string-parameter-helper.ts} | 16 +- .../ssm-parameter-helper.test.js.snap | 15 -- ...ts => ssm-string-parameter-helper.test.ts} | 25 +- 30 files changed, 208 insertions(+), 465 deletions(-) delete mode 100644 source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/__snapshots__/lambda-ssm-string-parameter.test.js.snap delete mode 100644 source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/tsconfig.json rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/.eslintignore (100%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/.gitignore (100%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/.npmignore (100%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/README.md (85%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/architecture.png (100%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/lib/index.ts (85%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/package.json (96%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.deployFunction.expected.json (93%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.deployFunction.ts (78%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.deployFunctionWithExistingVpc.expected.json (91%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.deployFunctionWithExistingVpc.ts (82%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.deployFunctionWithVpc.expected.json (92%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.deployFunctionWithVpc.ts (78%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.existingFunction.expected.json (97%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.existingFunction.ts (80%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.existingStringParameter.expected.json (94%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/integ.existingStringParameter.ts (80%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter/test/lambda-ssm-string-parameter.test.ts => aws-lambda-ssmstringparameter/test/lambda-ssmstringparameter.test.ts} (88%) rename source/patterns/@aws-solutions-constructs/{aws-lambda-ssm-string-parameter => aws-lambda-ssmstringparameter}/test/lambda/index.js (100%) rename source/patterns/@aws-solutions-constructs/core/lib/{ssm-parameter-helper.ts => ssm-string-parameter-helper.ts} (54%) delete mode 100644 source/patterns/@aws-solutions-constructs/core/test/__snapshots__/ssm-parameter-helper.test.js.snap rename source/patterns/@aws-solutions-constructs/core/test/{ssm-parameter-helper.test.ts => ssm-string-parameter-helper.test.ts} (60%) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda-dynamodb.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda-dynamodb.test.ts index 4065ef060..09d8fe7ab 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda-dynamodb.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda-dynamodb.test.ts @@ -716,7 +716,7 @@ test("Test minimal deployment with an existing VPC", () => { }); // -------------------------------------------------------------- -// Test minimal deployment with an existing VPC and existing Lambda function not in a VPCs +// Test minimal deployment with an existing VPC and existing Lambda function not in a VPC // // buildLambdaFunction should throw an error if the Lambda function is not // attached to a VPC diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/test/lambda-s3.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/test/lambda-s3.test.ts index 8243f86b9..827b0cd01 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/test/lambda-s3.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/test/lambda-s3.test.ts @@ -356,7 +356,7 @@ test("Test minimal deployment with an existing VPC", () => { }); // -------------------------------------------------------------- -// Test minimal deployment with an existing VPC and existing Lambda function not in a VPCs +// Test minimal deployment with an existing VPC and existing Lambda function not in a VPC // // buildLambdaFunction should throw an error if the Lambda function is not // attached to a VPC diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts index c3d186a19..165991bb6 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts @@ -99,10 +99,10 @@ test('Test deployment w/ existing function', () => { handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }; - const existingFuntion = defaults.deployLambdaFunction(stack, lambdaFunctionProps); + const existingFunction = defaults.deployLambdaFunction(stack, lambdaFunctionProps); const pattern = new LambdaToSecretsmanager(stack, 'lambda-to-secretsmanager-stack', { - existingLambdaObj: existingFuntion, + existingLambdaObj: existingFunction, secretProps: { removalPolicy: RemovalPolicy.DESTROY }, }); // Assertion 1 @@ -110,7 +110,7 @@ test('Test deployment w/ existing function', () => { GenerateSecretString: {}, }); // Assertion 2 - expect(pattern.lambdaFunction).toBe(existingFuntion); + expect(pattern.lambdaFunction).toBe(existingFunction); }); // -------------------------------------------------------------- @@ -291,7 +291,7 @@ test("Test minimal deployment with an existing VPC", () => { }); // -------------------------------------------------------------- -// Test minimal deployment with an existing VPC and existing Lambda function not in a VPCs +// Test minimal deployment with an existing VPC and existing Lambda function not in a VPC // // buildLambdaFunction should throw an error if the Lambda function is not // attached to a VPC diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts index 5a3afcff8..3f7970b2e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts @@ -309,7 +309,7 @@ test("Test minimal deployment with an existing VPC", () => { }); // -------------------------------------------------------------- -// Test minimal deployment with an existing VPC and existing Lambda function not in a VPCs +// Test minimal deployment with an existing VPC and existing Lambda function not in a VPC // // buildLambdaFunction should throw an error if the Lambda function is not // attached to a VPC diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/test/lambda-sqs.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/test/lambda-sqs.test.ts index a345fbc81..30aab4351 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/test/lambda-sqs.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/test/lambda-sqs.test.ts @@ -300,7 +300,7 @@ test("Test minimal deployment with an existing VPC", () => { }); // -------------------------------------------------------------- -// Test minimal deployment with an existing VPC and existing Lambda function not in a VPCs +// Test minimal deployment with an existing VPC and existing Lambda function not in a VPC // // buildLambdaFunction should throw an error if the Lambda function is not // attached to a VPC diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/__snapshots__/lambda-ssm-string-parameter.test.js.snap b/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/__snapshots__/lambda-ssm-string-parameter.test.js.snap deleted file mode 100644 index 6d695c6cd..000000000 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/__snapshots__/lambda-ssm-string-parameter.test.js.snap +++ /dev/null @@ -1,234 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Test minimal deployment with new Lambda function 1`] = ` -Object { - "Parameters": Object { - "AssetParameters0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8ArtifactHash8D9AD644": Object { - "Description": "Artifact hash for asset \\"0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8\\"", - "Type": "String", - }, - "AssetParameters0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8S3Bucket9E1964CB": Object { - "Description": "S3 bucket for asset \\"0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8\\"", - "Type": "String", - }, - "AssetParameters0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8S3VersionKey7153CEE7": Object { - "Description": "S3 key for asset version \\"0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8\\"", - "Type": "String", - }, - }, - "Resources": Object { - "lambdatossmstackLambdaFunctionD5C9EDB6": Object { - "DependsOn": Array [ - "lambdatossmstackLambdaFunctionServiceRoleDefaultPolicyC682BFD6", - "lambdatossmstackLambdaFunctionServiceRoleD0A34D48", - ], - "Metadata": Object { - "cfn_nag": Object { - "rules_to_suppress": Array [ - Object { - "id": "W58", - "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with tighter permissions.", - }, - Object { - "id": "W89", - "reason": "This is not a rule for the general case, just for specific use cases/industries", - }, - Object { - "id": "W92", - "reason": "Impossible for us to define the correct concurrency for clients", - }, - ], - }, - }, - "Properties": Object { - "Code": Object { - "S3Bucket": Object { - "Ref": "AssetParameters0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8S3Bucket9E1964CB", - }, - "S3Key": Object { - "Fn::Join": Array [ - "", - Array [ - Object { - "Fn::Select": Array [ - 0, - Object { - "Fn::Split": Array [ - "||", - Object { - "Ref": "AssetParameters0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8S3VersionKey7153CEE7", - }, - ], - }, - ], - }, - Object { - "Fn::Select": Array [ - 1, - Object { - "Fn::Split": Array [ - "||", - Object { - "Ref": "AssetParameters0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8S3VersionKey7153CEE7", - }, - ], - }, - ], - }, - ], - ], - }, - }, - "Environment": Object { - "Variables": Object { - "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", - "SSM_STRING_PARAMETER_NAME": Object { - "Ref": "lambdatossmstackstringParameterA6E27D57", - }, - }, - }, - "Handler": "index.handler", - "Role": Object { - "Fn::GetAtt": Array [ - "lambdatossmstackLambdaFunctionServiceRoleD0A34D48", - "Arn", - ], - }, - "Runtime": "nodejs10.x", - "TracingConfig": Object { - "Mode": "Active", - }, - }, - "Type": "AWS::Lambda::Function", - }, - "lambdatossmstackLambdaFunctionServiceRoleD0A34D48": Object { - "Properties": Object { - "AssumeRolePolicyDocument": Object { - "Statement": Array [ - Object { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": Object { - "Service": "lambda.amazonaws.com", - }, - }, - ], - "Version": "2012-10-17", - }, - "Policies": Array [ - Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents", - ], - "Effect": "Allow", - "Resource": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":logs:", - Object { - "Ref": "AWS::Region", - }, - ":", - Object { - "Ref": "AWS::AccountId", - }, - ":log-group:/aws/lambda/*", - ], - ], - }, - }, - ], - "Version": "2012-10-17", - }, - "PolicyName": "LambdaFunctionServiceRolePolicy", - }, - ], - }, - "Type": "AWS::IAM::Role", - }, - "lambdatossmstackLambdaFunctionServiceRoleDefaultPolicyC682BFD6": Object { - "Metadata": Object { - "cfn_nag": Object { - "rules_to_suppress": Array [ - Object { - "id": "W12", - "reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray and access ENIs in a VPC.", - }, - ], - }, - }, - "Properties": Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "xray:PutTraceSegments", - "xray:PutTelemetryRecords", - ], - "Effect": "Allow", - "Resource": "*", - }, - Object { - "Action": Array [ - "ssm:DescribeParameters", - "ssm:GetParameters", - "ssm:GetParameter", - "ssm:GetParameterHistory", - ], - "Effect": "Allow", - "Resource": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":ssm:", - Object { - "Ref": "AWS::Region", - }, - ":", - Object { - "Ref": "AWS::AccountId", - }, - ":parameter/", - Object { - "Ref": "lambdatossmstackstringParameterA6E27D57", - }, - ], - ], - }, - }, - ], - "Version": "2012-10-17", - }, - "PolicyName": "lambdatossmstackLambdaFunctionServiceRoleDefaultPolicyC682BFD6", - "Roles": Array [ - Object { - "Ref": "lambdatossmstackLambdaFunctionServiceRoleD0A34D48", - }, - ], - }, - "Type": "AWS::IAM::Policy", - }, - "lambdatossmstackstringParameterA6E27D57": Object { - "Properties": Object { - "Type": "String", - "Value": "test-string-value", - }, - "Type": "AWS::SSM::Parameter", - }, - }, -} -`; diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/tsconfig.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/tsconfig.json deleted file mode 100644 index 1b7d2bae0..000000000 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/tsconfig.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "charset": "utf8", - "declaration": true, - "experimentalDecorators": true, - "incremental": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": [ - "es2018" - ], - "module": "CommonJS", - "newLine": "lf", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "strict": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "stripInternal": false, - "target": "ES2018", - "composite": false, - "tsBuildInfoFile": "tsconfig.tsbuildinfo" - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "node_modules" - ], - "_generated_by_jsii_": "Generated by jsii - safe to delete, and ideally should be in .gitignore" -} diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/.eslintignore b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/.eslintignore similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/.eslintignore rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/.eslintignore diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/.gitignore b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/.gitignore similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/.gitignore rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/.gitignore diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/.npmignore b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/.npmignore similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/.npmignore rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/.npmignore diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md similarity index 85% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/README.md rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md index 7edb33613..4cb84dcb6 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md @@ -1,4 +1,4 @@ -# aws-lambda-ssm-string-parameter module +# aws-lambda-ssmstringparameter module --- @@ -19,7 +19,7 @@ | **Language** | **Package** | |:-------------|-----------------| |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_lambda_ssm_string_parameter`| -|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-lambda-ssm-string-parameter`| +|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-lambda-ssmstringparameter`| |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.lambdassmstringparameter`| This AWS Solutions Construct implements the AWS Lambda function and AWS Systems Manager Parameter Store String parameter with the least privileged permissions. @@ -27,9 +27,9 @@ This AWS Solutions Construct implements the AWS Lambda function and AWS Systems Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { LambdaToSsmStringParameterProps, LambdaToSsmStringParameter } from '@aws-solutions-constructs/aws-lambda-ssm-string-parameter'; +const { LambdaToSsmstringparameterProps, LambdaToSsmstringparameter } from '@aws-solutions-constructs/aws-lambda-ssmstringparameter'; -const props: LambdaToSsmStringParameterProps = { +const props: LambdaToSsmstringparameterProps = { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_14_X, // This assumes a handler function in lib/lambda/index.js @@ -39,30 +39,30 @@ const props: LambdaToSsmStringParameterProps = { stringParameterProps: { stringValue: "test-string-value" } }; -new LambdaToSsmStringParameter(this, 'test-lambda-ssm-string-parameter-stack', props); +new LambdaToSsmstringparameter(this, 'test-lambda-ssmstringparameter-stack', props); ``` ## Initializer ``` text -new LambdaToSsmStringParameter(scope: Construct, id: string, props: LambdaToSsmStringParameterProps); +new LambdaToSsmstringparameter(scope: Construct, id: string, props: LambdaToSsmstringparameterProps); ``` _Parameters_ * scope [`Construct`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html) * id `string` -* props [`LambdaToSsmStringParameterProps`](#pattern-construct-props) +* props [`LambdaToSsmstringparameterProps`](#pattern-construct-props) ## Pattern Construct Props | **Name** | **Type** | **Description** | |:-------------|:----------------|-----------------| -|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored.| +|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.| |lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.| -|stringParameterProps?|[`ssm.StringParameterProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ssm.StringParameterProps.html)|Optional user provided props to override the default props for SSM String parameter. If existingStringParameterObj is not set stringParameterProps is required.| -|existingStringParameterObj?|[`ssm.StringParameter`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ssm.StringParameter.html)|Existing instance of SSM String parameter object, If this is set then the stringParameterProps is ignored| +|existingStringParameterObj?|[`ssm.StringParameter`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ssm.StringParameter.html)|Existing instance of SSM String parameter object, providing both this and `stringParameterProps` will cause an error| +|stringParameterProps?|[`ssm.StringParameterProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ssm.StringParameterProps.html)|Optional user provided props to override the default props for SSM String parameter. If existingStringParameterObj is not set stringParameterProps is required. The only supported [`ssm.StringParameterProps.type`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ssm.StringParameterProps.html#type) is [`STRING`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ssm.ParameterType.html#string) if a different value is provided it will be overridden.| |stringParameterEnvironmentVariableName?|`string`|Optional Name for the SSM String parameter environment variable set for the Lambda function.| |existingVpc?|[`ec2.IVpc`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.IVpc.html)|An optional, existing VPC into which this pattern should be deployed. When deployed in a VPC, the Lambda function will use ENIs in the VPC to access network resources and an Interface Endpoint will be created in the VPC for AWS Systems Manager Parameter. If an existing VPC is provided, the `deployVpc` property cannot be `true`. This uses `ec2.IVpc` to allow clients to supply VPCs that exist outside the stack using the [`ec2.Vpc.fromLookup()`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Vpc.html#static-fromwbrlookupscope-id-options) method.| |vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.VpcProps.html)|Optional user-provided properties to override the default properties for the new VPC. `enableDnsHostnames`, `enableDnsSupport`, `natGateways` and `subnetConfiguration` are set by the pattern, so any values for those properties supplied here will be overrriden. If `deployVpc` is not `true` then this property will be ignored.| diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/architecture.png b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/architecture.png similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/architecture.png rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/architecture.png diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/lib/index.ts similarity index 85% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/lib/index.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/lib/index.ts index 069229c57..7b83a5547 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/lib/index.ts @@ -19,9 +19,9 @@ import * as ec2 from "@aws-cdk/aws-ec2"; import {Construct} from "@aws-cdk/core"; /** - * @summary The properties for the LambdaToSsmStringParameter class. + * @summary The properties for the LambdaToSsmstringparameter class. */ -export interface LambdaToSsmStringParameterProps { +export interface LambdaToSsmstringparameterProps { /** * Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored. * @@ -42,7 +42,7 @@ export interface LambdaToSsmStringParameterProps { readonly existingStringParameterObj?: ssm.StringParameter; /** * Optional user provided props to override the default props for SSM String parameter. If existingStringParameterObj - * is not set stringParameterProps is required. + * is not set stringParameterProps is required. The only supported string parameter type is ParameterType.STRING. * * @default - Default props are used */ @@ -77,29 +77,26 @@ export interface LambdaToSsmStringParameterProps { } /** - * @summary The LambdaToSsmStringParameter class. + * @summary The LambdaToSsmstringparameter class. */ -export class LambdaToSsmStringParameter extends Construct { +export class LambdaToSsmstringparameter extends Construct { public readonly lambdaFunction: lambda.Function; public readonly stringParameter: ssm.StringParameter; public readonly vpc?: ec2.IVpc; /** - * @summary Constructs a new instance of the LambdaToSsmStringParameter class. + * @summary Constructs a new instance of the LambdaToSsmstringparameter class. * @param {cdk.App} scope - represents the scope for all the resources. * @param {string} id - this is a a scope-unique id. - * @param {LambdaToSsmStringParameterProps} props - user provided props for the construct. + * @param {LambdaToSsmstringparameterProps} props - user provided props for the construct. * @since 1.49.0 * @access public */ - constructor(scope: Construct, id: string, props: LambdaToSsmStringParameterProps) { + constructor(scope: Construct, id: string, props: LambdaToSsmstringparameterProps) { super(scope, id); + defaults.CheckProps(props); if (props.deployVpc || props.existingVpc) { - if (props.deployVpc && props.existingVpc) { - throw new Error("More than 1 VPC specified in the properties"); - } - this.vpc = defaults.buildVpc(scope, { defaultVpcProps: defaults.DefaultIsolatedVpcProps(), existingVpc: props.existingVpc, @@ -127,7 +124,7 @@ export class LambdaToSsmStringParameter extends Construct { if (!props.stringParameterProps) { throw new Error("existingStringParameterObj or stringParameterProps needs to be provided."); } - this.stringParameter = defaults.buildSsmStringParamter(this, 'stringParameter', props.stringParameterProps); + this.stringParameter = defaults.buildSsmStringParameter(this, 'stringParameter', props.stringParameterProps); } // Configure environment variables diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json similarity index 96% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/package.json rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json index c03471ac8..1b74953b9 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-solutions-constructs/aws-lambda-ssm-string-parameter", + "name": "@aws-solutions-constructs/aws-lambda-ssmstringparameter", "version": "0.0.0", "description": "CDK constructs for defining an interaction between an AWS Lambda function and AWS Systems Manager Parameter Store String parameter", "main": "lib/index.js", @@ -7,7 +7,7 @@ "repository": { "type": "git", "url": "https://github.com/awslabs/aws-solutions-constructs.git", - "directory": "source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter" + "directory": "source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter" }, "author": { "name": "Amazon Web Services", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunction.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunction.expected.json similarity index 93% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunction.expected.json rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunction.expected.json index c34a07372..509125b4e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunction.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunction.expected.json @@ -1,7 +1,7 @@ { - "Description": "Integration Test for aws-lambda-ssm-string-parameter", + "Description": "Integration Test for aws-lambda-ssmstringparameter", "Resources": { - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B": { + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -56,7 +56,7 @@ ] } }, - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286": { + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -95,7 +95,7 @@ }, ":parameter/", { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } ] ] @@ -104,10 +104,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", + "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", "Roles": [ { - "Ref": "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "Ref": "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" } ] }, @@ -122,7 +122,7 @@ } } }, - "testlambdassmstringparameterLambdaFunctionD6B07836": { + "testlambdassmstringparameterLambdaFunctionD0F9E80D": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { @@ -165,7 +165,7 @@ }, "Role": { "Fn::GetAtt": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916", "Arn" ] }, @@ -173,7 +173,7 @@ "Variables": { "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", "SSM_STRING_PARAMETER_NAME": { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } } }, @@ -184,8 +184,8 @@ } }, "DependsOn": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" ], "Metadata": { "cfn_nag": { @@ -206,7 +206,7 @@ } } }, - "testlambdassmstringparameterstringParameter13A21240": { + "testlambdassmstringparameterstringParameter680CABAC": { "Type": "AWS::SSM::Parameter", "Properties": { "Type": "String", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunction.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunction.ts similarity index 78% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunction.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunction.ts index 9e59dbb6e..ecc9a4b19 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunction.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunction.ts @@ -13,16 +13,16 @@ // Imports import {App, Stack} from "@aws-cdk/core"; -import {LambdaToSsmStringParameter, LambdaToSsmStringParameterProps} from '../lib'; +import {LambdaToSsmstringparameter, LambdaToSsmstringparameterProps} from '../lib'; import * as lambda from '@aws-cdk/aws-lambda'; // Setup const app = new App(); -const stack = new Stack(app, 'test-lambda-ssm-string-parameter'); -stack.templateOptions.description = 'Integration Test for aws-lambda-ssm-string-parameter'; +const stack = new Stack(app, 'test-lambda-ssmstringparameter'); +stack.templateOptions.description = 'Integration Test for aws-lambda-ssmstringparameter'; // Definitions -const props: LambdaToSsmStringParameterProps = { +const props: LambdaToSsmstringparameterProps = { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_10_X, handler: 'index.handler', @@ -31,7 +31,7 @@ const props: LambdaToSsmStringParameterProps = { stringParameterProps: { stringValue: "test-string-value" } }; -new LambdaToSsmStringParameter(stack, 'test-lambda-ssm-string-parameter', props); +new LambdaToSsmstringparameter(stack, 'test-lambda-ssmstringparameter', props); // Synth app.synth(); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithExistingVpc.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithExistingVpc.expected.json similarity index 91% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithExistingVpc.expected.json rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithExistingVpc.expected.json index c134171c2..a6eb65380 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithExistingVpc.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithExistingVpc.expected.json @@ -1,5 +1,5 @@ { - "Description": "Integration Test for test-lambda-ssm-string-parameter", + "Description": "Integration Test for test-lambda-ssmstringparameter", "Resources": { "Vpc8378EB38": { "Type": "AWS::EC2::VPC", @@ -11,7 +11,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc" + "Value": "test-lambda-ssmstringparameter-stack/Vpc" } ] } @@ -36,7 +36,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet1" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet1" } ] }, @@ -60,7 +60,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet1" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet1" } ] } @@ -98,7 +98,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet1" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet1" } ] } @@ -118,7 +118,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet1" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet1" } ] } @@ -143,7 +143,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet2" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet2" } ] }, @@ -167,7 +167,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet2" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet2" } ] } @@ -205,7 +205,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet2" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet2" } ] } @@ -225,7 +225,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet2" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet2" } ] } @@ -250,7 +250,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet3" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet3" } ] }, @@ -274,7 +274,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet3" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet3" } ] } @@ -312,7 +312,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet3" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet3" } ] } @@ -332,7 +332,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PublicSubnet3" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PublicSubnet3" } ] } @@ -357,7 +357,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PrivateSubnet1" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PrivateSubnet1" } ] } @@ -371,7 +371,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PrivateSubnet1" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PrivateSubnet1" } ] } @@ -419,7 +419,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PrivateSubnet2" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PrivateSubnet2" } ] } @@ -433,7 +433,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PrivateSubnet2" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PrivateSubnet2" } ] } @@ -481,7 +481,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PrivateSubnet3" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PrivateSubnet3" } ] } @@ -495,7 +495,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc/PrivateSubnet3" + "Value": "test-lambda-ssmstringparameter-stack/Vpc/PrivateSubnet3" } ] } @@ -529,7 +529,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc" + "Value": "test-lambda-ssmstringparameter-stack/Vpc" } ] } @@ -563,7 +563,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc" + "Value": "test-lambda-ssmstringparameter-stack/Vpc" } ] } @@ -647,7 +647,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter-stack/Vpc" + "Value": "test-lambda-ssmstringparameter-stack/Vpc" } ] } @@ -693,7 +693,7 @@ "VpcEndpointType": "Interface" } }, - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B": { + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -748,7 +748,7 @@ ] } }, - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286": { + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -798,7 +798,7 @@ }, ":parameter/", { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } ] ] @@ -807,10 +807,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", + "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", "Roles": [ { - "Ref": "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "Ref": "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" } ] }, @@ -825,10 +825,10 @@ } } }, - "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroup38D3BA6A": { + "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroupBB1CB03C": { "Type": "AWS::EC2::SecurityGroup", "Properties": { - "GroupDescription": "test-lambda-ssm-string-parameter-stack/test-lambda-ssm-string-parameter/ReplaceDefaultSecurityGroup-security-group", + "GroupDescription": "test-lambda-ssmstringparameter-stack/test-lambda-ssmstringparameter/ReplaceDefaultSecurityGroup-security-group", "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", @@ -855,7 +855,7 @@ } } }, - "testlambdassmstringparameterLambdaFunctionD6B07836": { + "testlambdassmstringparameterLambdaFunctionD0F9E80D": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { @@ -898,7 +898,7 @@ }, "Role": { "Fn::GetAtt": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916", "Arn" ] }, @@ -906,7 +906,7 @@ "Variables": { "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", "SSM_STRING_PARAMETER_NAME": { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } } }, @@ -919,7 +919,7 @@ "SecurityGroupIds": [ { "Fn::GetAtt": [ - "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroup38D3BA6A", + "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroupBB1CB03C", "GroupId" ] } @@ -938,8 +938,8 @@ } }, "DependsOn": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" ], "Metadata": { "cfn_nag": { @@ -960,7 +960,7 @@ } } }, - "testlambdassmstringparameterstringParameter13A21240": { + "testlambdassmstringparameterstringParameter680CABAC": { "Type": "AWS::SSM::Parameter", "Properties": { "Type": "String", @@ -970,7 +970,7 @@ "ReplaceEndpointDefaultSecurityGroupsecuritygroupB97DD1AF": { "Type": "AWS::EC2::SecurityGroup", "Properties": { - "GroupDescription": "test-lambda-ssm-string-parameter-stack/ReplaceEndpointDefaultSecurityGroup-security-group", + "GroupDescription": "test-lambda-ssmstringparameter-stack/ReplaceEndpointDefaultSecurityGroup-security-group", "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithExistingVpc.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithExistingVpc.ts similarity index 82% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithExistingVpc.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithExistingVpc.ts index 614a2d33e..2e53eec1e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithExistingVpc.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithExistingVpc.ts @@ -13,14 +13,14 @@ // Imports import {App, Stack} from "@aws-cdk/core"; -import {LambdaToSsmStringParameter, LambdaToSsmStringParameterProps} from '../lib'; +import {LambdaToSsmstringparameter, LambdaToSsmstringparameterProps} from '../lib'; import * as lambda from "@aws-cdk/aws-lambda"; import * as defaults from '@aws-solutions-constructs/core'; // Setup const app = new App(); -const stack = new Stack(app, "test-lambda-ssm-string-parameter-stack"); -stack.templateOptions.description = "Integration Test for test-lambda-ssm-string-parameter"; +const stack = new Stack(app, "test-lambda-ssmstringparameter-stack"); +stack.templateOptions.description = "Integration Test for test-lambda-ssmstringparameter"; // Create VPC const vpc = defaults.buildVpc(stack, { @@ -32,7 +32,7 @@ const vpc = defaults.buildVpc(stack, { }); // Definitions -const props: LambdaToSsmStringParameterProps = { +const props: LambdaToSsmstringparameterProps = { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_10_X, handler: 'index.handler', @@ -42,7 +42,7 @@ const props: LambdaToSsmStringParameterProps = { existingVpc: vpc }; -new LambdaToSsmStringParameter(stack, 'test-lambda-ssm-string-parameter', props); +new LambdaToSsmstringparameter(stack, 'test-lambda-ssmstringparameter', props); // Synth app.synth(); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithVpc.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithVpc.expected.json similarity index 92% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithVpc.expected.json rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithVpc.expected.json index ed82fdf3d..eb50a7a1a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithVpc.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithVpc.expected.json @@ -1,7 +1,7 @@ { - "Description": "Integration Test for aws-lambda-ssm-string-parameter", + "Description": "Integration Test for aws-lambda-ssmstringparameter", "Resources": { - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B": { + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -56,7 +56,7 @@ ] } }, - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286": { + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -106,7 +106,7 @@ }, ":parameter/", { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } ] ] @@ -115,10 +115,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", + "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", "Roles": [ { - "Ref": "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "Ref": "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" } ] }, @@ -133,10 +133,10 @@ } } }, - "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroup38D3BA6A": { + "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroupBB1CB03C": { "Type": "AWS::EC2::SecurityGroup", "Properties": { - "GroupDescription": "test-lambda-ssm-string-parameter/test-lambda-ssm-string-parameter/ReplaceDefaultSecurityGroup-security-group", + "GroupDescription": "test-lambda-ssmstringparameter/test-lambda-ssmstringparameter/ReplaceDefaultSecurityGroup-security-group", "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", @@ -163,7 +163,7 @@ } } }, - "testlambdassmstringparameterLambdaFunctionD6B07836": { + "testlambdassmstringparameterLambdaFunctionD0F9E80D": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { @@ -206,7 +206,7 @@ }, "Role": { "Fn::GetAtt": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916", "Arn" ] }, @@ -214,7 +214,7 @@ "Variables": { "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", "SSM_STRING_PARAMETER_NAME": { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } } }, @@ -227,7 +227,7 @@ "SecurityGroupIds": [ { "Fn::GetAtt": [ - "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroup38D3BA6A", + "testlambdassmstringparameterReplaceDefaultSecurityGroupsecuritygroupBB1CB03C", "GroupId" ] } @@ -246,8 +246,8 @@ } }, "DependsOn": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" ], "Metadata": { "cfn_nag": { @@ -268,7 +268,7 @@ } } }, - "testlambdassmstringparameterstringParameter13A21240": { + "testlambdassmstringparameterstringParameter680CABAC": { "Type": "AWS::SSM::Parameter", "Properties": { "Type": "String", @@ -285,7 +285,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc" + "Value": "test-lambda-ssmstringparameter/Vpc" } ] } @@ -310,7 +310,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc/isolatedSubnet1" + "Value": "test-lambda-ssmstringparameter/Vpc/isolatedSubnet1" } ] } @@ -324,7 +324,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc/isolatedSubnet1" + "Value": "test-lambda-ssmstringparameter/Vpc/isolatedSubnet1" } ] } @@ -360,7 +360,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc/isolatedSubnet2" + "Value": "test-lambda-ssmstringparameter/Vpc/isolatedSubnet2" } ] } @@ -374,7 +374,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc/isolatedSubnet2" + "Value": "test-lambda-ssmstringparameter/Vpc/isolatedSubnet2" } ] } @@ -410,7 +410,7 @@ }, { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc/isolatedSubnet3" + "Value": "test-lambda-ssmstringparameter/Vpc/isolatedSubnet3" } ] } @@ -424,7 +424,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc/isolatedSubnet3" + "Value": "test-lambda-ssmstringparameter/Vpc/isolatedSubnet3" } ] } @@ -458,7 +458,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc" + "Value": "test-lambda-ssmstringparameter/Vpc" } ] } @@ -542,7 +542,7 @@ "Tags": [ { "Key": "Name", - "Value": "test-lambda-ssm-string-parameter/Vpc" + "Value": "test-lambda-ssmstringparameter/Vpc" } ] } @@ -591,7 +591,7 @@ "ReplaceEndpointDefaultSecurityGroupsecuritygroupB97DD1AF": { "Type": "AWS::EC2::SecurityGroup", "Properties": { - "GroupDescription": "test-lambda-ssm-string-parameter/ReplaceEndpointDefaultSecurityGroup-security-group", + "GroupDescription": "test-lambda-ssmstringparameter/ReplaceEndpointDefaultSecurityGroup-security-group", "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithVpc.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithVpc.ts similarity index 78% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithVpc.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithVpc.ts index 5ee2ec3e7..c7bc6316f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.deployFunctionWithVpc.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.deployFunctionWithVpc.ts @@ -13,16 +13,16 @@ // Imports import {App, Stack} from "@aws-cdk/core"; -import {LambdaToSsmStringParameter, LambdaToSsmStringParameterProps} from '../lib'; +import {LambdaToSsmstringparameter, LambdaToSsmstringparameterProps} from '../lib'; import * as lambda from '@aws-cdk/aws-lambda'; // Setup const app = new App(); -const stack = new Stack(app, "test-lambda-ssm-string-parameter"); -stack.templateOptions.description = "Integration Test for aws-lambda-ssm-string-parameter"; +const stack = new Stack(app, "test-lambda-ssmstringparameter"); +stack.templateOptions.description = "Integration Test for aws-lambda-ssmstringparameter"; // Definitions -const props: LambdaToSsmStringParameterProps = { +const props: LambdaToSsmstringparameterProps = { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_10_X, handler: 'index.handler', @@ -32,7 +32,7 @@ const props: LambdaToSsmStringParameterProps = { deployVpc: true, }; -new LambdaToSsmStringParameter(stack, 'test-lambda-ssm-string-parameter', props); +new LambdaToSsmstringparameter(stack, 'test-lambda-ssmstringparameter', props); // Synth app.synth(); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingFunction.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingFunction.expected.json similarity index 97% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingFunction.expected.json rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingFunction.expected.json index b8c846097..2e0ef3e1b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingFunction.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingFunction.expected.json @@ -1,5 +1,5 @@ { - "Description": "Integration Test for aws-lambda-ssm-string-parameter", + "Description": "Integration Test for aws-lambda-ssmstringparameter", "Resources": { "LambdaFunctionServiceRole0C4CDE0B": { "Type": "AWS::IAM::Role", @@ -95,7 +95,7 @@ }, ":parameter/", { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } ] ] @@ -173,7 +173,7 @@ "Variables": { "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", "SSM_STRING_PARAMETER_NAME": { - "Ref": "testlambdassmstringparameterstringParameter13A21240" + "Ref": "testlambdassmstringparameterstringParameter680CABAC" } } }, @@ -206,7 +206,7 @@ } } }, - "testlambdassmstringparameterstringParameter13A21240": { + "testlambdassmstringparameterstringParameter680CABAC": { "Type": "AWS::SSM::Parameter", "Properties": { "Type": "String", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingFunction.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingFunction.ts similarity index 80% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingFunction.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingFunction.ts index e3c3fc8a1..702726195 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingFunction.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingFunction.ts @@ -13,14 +13,14 @@ // Imports import {App, Stack} from "@aws-cdk/core"; -import {LambdaToSsmStringParameter, LambdaToSsmStringParameterProps} from '../lib'; +import {LambdaToSsmstringparameter, LambdaToSsmstringparameterProps} from '../lib'; import * as lambda from '@aws-cdk/aws-lambda'; import * as defaults from '@aws-solutions-constructs/core'; // Setup const app = new App(); -const stack = new Stack(app, 'test-lambda-ssm-string-parameter'); -stack.templateOptions.description = 'Integration Test for aws-lambda-ssm-string-parameter'; +const stack = new Stack(app, 'test-lambda-ssmstringparameter'); +stack.templateOptions.description = 'Integration Test for aws-lambda-ssmstringparameter'; // Definitions const lambdaFunctionProps = { @@ -30,12 +30,12 @@ const lambdaFunctionProps = { }; const func = defaults.deployLambdaFunction(stack, lambdaFunctionProps); -const props: LambdaToSsmStringParameterProps = { +const props: LambdaToSsmstringparameterProps = { existingLambdaObj: func, stringParameterProps: { stringValue: "test-string-value" } }; -new LambdaToSsmStringParameter(stack, 'test-lambda-ssm-string-parameter', props); +new LambdaToSsmstringparameter(stack, 'test-lambda-ssmstringparameter', props); // Synth app.synth(); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingStringParameter.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingStringParameter.expected.json similarity index 94% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingStringParameter.expected.json rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingStringParameter.expected.json index 874c65091..51f0c3965 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingStringParameter.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingStringParameter.expected.json @@ -1,5 +1,5 @@ { - "Description": "Integration Test for aws-lambda-ssm-string-parameter", + "Description": "Integration Test for aws-lambda-ssmstringparameter", "Resources": { "myNewStringParameter97217FB9": { "Type": "AWS::SSM::Parameter", @@ -8,7 +8,7 @@ "Value": "test-string-value" } }, - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B": { + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -63,7 +63,7 @@ ] } }, - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286": { + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897": { "Type": "AWS::IAM::Policy", "Properties": { "PolicyDocument": { @@ -111,10 +111,10 @@ ], "Version": "2012-10-17" }, - "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", + "PolicyName": "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", "Roles": [ { - "Ref": "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "Ref": "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" } ] }, @@ -129,7 +129,7 @@ } } }, - "testlambdassmstringparameterLambdaFunctionD6B07836": { + "testlambdassmstringparameterLambdaFunctionD0F9E80D": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { @@ -172,7 +172,7 @@ }, "Role": { "Fn::GetAtt": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916", "Arn" ] }, @@ -191,8 +191,8 @@ } }, "DependsOn": [ - "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicy8BB4C286", - "testlambdassmstringparameterLambdaFunctionServiceRoleE748CB3B" + "testlambdassmstringparameterLambdaFunctionServiceRoleDefaultPolicyA31F1897", + "testlambdassmstringparameterLambdaFunctionServiceRole0E6B5916" ], "Metadata": { "cfn_nag": { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingStringParameter.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingStringParameter.ts similarity index 80% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingStringParameter.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingStringParameter.ts index e92969bb5..3662e8a9e 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/integ.existingStringParameter.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/integ.existingStringParameter.ts @@ -13,18 +13,18 @@ // Imports import {App, Stack} from "@aws-cdk/core"; -import {LambdaToSsmStringParameter, LambdaToSsmStringParameterProps} from '../lib'; +import {LambdaToSsmstringparameter, LambdaToSsmstringparameterProps} from '../lib'; import * as lambda from '@aws-cdk/aws-lambda'; import { StringParameter } from "@aws-cdk/aws-ssm"; // Setup const app = new App(); -const stack = new Stack(app, 'test-lambda-ssm-string-parameter'); -stack.templateOptions.description = 'Integration Test for aws-lambda-ssm-string-parameter'; +const stack = new Stack(app, 'test-lambda-ssmstringparameter'); +stack.templateOptions.description = 'Integration Test for aws-lambda-ssmstringparameter'; const existingStringParam = new StringParameter(stack, 'myNewStringParameter', {stringValue: "test-string-value" }); // Definitions -const props: LambdaToSsmStringParameterProps = { +const props: LambdaToSsmstringparameterProps = { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_10_X, handler: 'index.handler', @@ -33,7 +33,7 @@ const props: LambdaToSsmStringParameterProps = { existingStringParameterObj: existingStringParam }; -new LambdaToSsmStringParameter(stack, 'test-lambda-ssm-string-parameter', props); +new LambdaToSsmstringparameter(stack, 'test-lambda-ssmstringparameter', props); // Synth app.synth(); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/lambda-ssm-string-parameter.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda-ssmstringparameter.test.ts similarity index 88% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/lambda-ssm-string-parameter.test.ts rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda-ssmstringparameter.test.ts index 1fde5c445..c5cbe32b2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/lambda-ssm-string-parameter.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda-ssmstringparameter.test.ts @@ -15,7 +15,7 @@ import { Stack } from "@aws-cdk/core"; import * as lambda from "@aws-cdk/aws-lambda"; import * as ec2 from "@aws-cdk/aws-ec2"; -import { LambdaToSsmStringParameter } from '../lib'; +import { LambdaToSsmstringparameter } from '../lib'; import { SynthUtils } from '@aws-cdk/assert'; import '@aws-cdk/assert/jest'; import { StringParameter } from "@aws-cdk/aws-ssm"; @@ -28,9 +28,9 @@ test('Test minimal deployment with new Lambda function', () => { // Stack const stack = new Stack(); // Helper declaration - new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }, @@ -48,7 +48,7 @@ test('Test lambda function custom environment variable', () => { const stack = new Stack(); // Helper declaration - new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', @@ -83,9 +83,9 @@ test('Test the properties', () => { // Stack const stack = new Stack(); // Helper declaration - const pattern = new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + const pattern = new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }, @@ -107,9 +107,9 @@ test('Test deployment w/ existing String Parameter', () => { const stack = new Stack(); // Helper declaration const existingStringParam = new StringParameter(stack, 'myNewStringParameter', {stringValue: "test-string-value" }); - const pattern = new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + const pattern = new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }, @@ -133,14 +133,14 @@ test('Test deployment w/ existing function', () => { const stack = new Stack(); // Helper declaration const lambdaFunctionProps = { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }; - const existingFuntion = defaults.deployLambdaFunction(stack, lambdaFunctionProps); + const existingFunction = defaults.deployLambdaFunction(stack, lambdaFunctionProps); - const pattern = new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { - existingLambdaObj: existingFuntion, + const pattern = new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { + existingLambdaObj: existingFunction, stringParameterProps: { stringValue: "test-string-value" }, }); // Assertion 1 @@ -149,7 +149,7 @@ test('Test deployment w/ existing function', () => { Value: "test-string-value" }); // Assertion 2 - expect(pattern.lambdaFunction).toBe(existingFuntion); + expect(pattern.lambdaFunction).toBe(existingFunction); }); // -------------------------------------------------------------- @@ -159,9 +159,9 @@ test('Test minimal deployment write access to String Parameter ', () => { // Stack const stack = new Stack(); // Helper declaration - new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`), }, @@ -183,9 +183,9 @@ test("Test minimal deployment that deploys a VPC without vpcProps", () => { // Stack const stack = new Stack(); // Helper declaration - new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }, @@ -234,9 +234,9 @@ test("Test minimal deployment that deploys a VPC w/vpcProps", () => { // Stack const stack = new Stack(); // Helper declaration - new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }, @@ -294,9 +294,9 @@ test("Test minimal deployment with an existing VPC", () => { const testVpc = new ec2.Vpc(stack, "test-vpc", {}); // Helper declaration - new LambdaToSsmStringParameter(stack, 'lambda-to-ssm-stack', { + new LambdaToSsmstringparameter(stack, 'lambda-to-ssm-stack', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) }, @@ -331,7 +331,7 @@ test("Test minimal deployment with an existing VPC", () => { }); // -------------------------------------------------------------- -// Test minimal deployment with an existing VPC and existing Lambda function not in a VPCs +// Test minimal deployment with an existing VPC and existing Lambda function not in a VPC // // buildLambdaFunction should throw an error if the Lambda function is not // attached to a VPC @@ -341,7 +341,7 @@ test("Test minimal deployment with an existing VPC and existing Lambda function const stack = new Stack(); const testLambdaFunction = new lambda.Function(stack, 'test-lamba', { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: "index.handler", code: lambda.Code.fromAsset(`${__dirname}/lambda`), }); @@ -351,7 +351,7 @@ test("Test minimal deployment with an existing VPC and existing Lambda function // Helper declaration const app = () => { // Helper declaration - new LambdaToSsmStringParameter(stack, "lambda-to-ssm-stack", { + new LambdaToSsmstringparameter(stack, "lambda-to-ssm-stack", { existingLambdaObj: testLambdaFunction, existingVpc: testVpc, stringParameterProps: { stringValue: "test-string-value" } @@ -374,9 +374,9 @@ test("Test bad call with existingVpc and deployVpc", () => { const app = () => { // Helper declaration - new LambdaToSsmStringParameter(stack, "lambda-to-ssm-stack", { + new LambdaToSsmstringparameter(stack, "lambda-to-ssm-stack", { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_14_X, handler: "index.handler", code: lambda.Code.fromAsset(`${__dirname}/lambda`), }, @@ -387,4 +387,4 @@ test("Test bad call with existingVpc and deployVpc", () => { }; // Assertion expect(app).toThrowError(); -}); \ No newline at end of file +}); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda/index.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-lambda-ssm-string-parameter/test/lambda/index.js rename to source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda/index.js diff --git a/source/patterns/@aws-solutions-constructs/core/index.ts b/source/patterns/@aws-solutions-constructs/core/index.ts index beb93486d..9379a1c1f 100644 --- a/source/patterns/@aws-solutions-constructs/core/index.ts +++ b/source/patterns/@aws-solutions-constructs/core/index.ts @@ -60,4 +60,4 @@ export * from './lib/glue-database-defaults'; export * from './lib/glue-database-helper'; export * from './lib/input-validation'; export * from './test/test-helper'; -export * from './lib/ssm-parameter-helper'; +export * from './lib/ssm-string-parameter-helper'; diff --git a/source/patterns/@aws-solutions-constructs/core/lib/ssm-parameter-helper.ts b/source/patterns/@aws-solutions-constructs/core/lib/ssm-string-parameter-helper.ts similarity index 54% rename from source/patterns/@aws-solutions-constructs/core/lib/ssm-parameter-helper.ts rename to source/patterns/@aws-solutions-constructs/core/lib/ssm-string-parameter-helper.ts index dc28785b8..5013529d6 100644 --- a/source/patterns/@aws-solutions-constructs/core/lib/ssm-parameter-helper.ts +++ b/source/patterns/@aws-solutions-constructs/core/lib/ssm-string-parameter-helper.ts @@ -11,8 +11,9 @@ * and limitations under the License. */ -import {StringParameter, StringParameterProps} from '@aws-cdk/aws-ssm'; +import {ParameterType, StringParameter, StringParameterProps} from '@aws-cdk/aws-ssm'; import {Construct} from '@aws-cdk/core'; +import {printWarning} from "./utils"; /** * Method to build the default AWS SSM Parameter Store @@ -21,6 +22,15 @@ import {Construct} from '@aws-cdk/core'; * @param id * @param stringParameterProps */ -export function buildSsmStringParamter(scope: Construct, id: string, stringParameterProps: StringParameterProps): StringParameter { - return new StringParameter(scope, id, stringParameterProps); +export function buildSsmStringParameter(scope: Construct, id: string, stringParameterProps: StringParameterProps): StringParameter { + let props: StringParameterProps = stringParameterProps; + + if (stringParameterProps.type && stringParameterProps.type !== ParameterType.STRING) { + printWarning('Overriding SSM String Parameter type to be ParameterType.STRING'); + props = { + ...stringParameterProps, + type: ParameterType.STRING + }; + } + return new StringParameter(scope, id, props); } diff --git a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/ssm-parameter-helper.test.js.snap b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/ssm-parameter-helper.test.js.snap deleted file mode 100644 index 124be212b..000000000 --- a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/ssm-parameter-helper.test.js.snap +++ /dev/null @@ -1,15 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Test minimal deployment with required properties 1`] = ` -Object { - "Resources": Object { - "parameterName95084137": Object { - "Properties": Object { - "Type": "String", - "Value": "test-val", - }, - "Type": "AWS::SSM::Parameter", - }, - }, -} -`; diff --git a/source/patterns/@aws-solutions-constructs/core/test/ssm-parameter-helper.test.ts b/source/patterns/@aws-solutions-constructs/core/test/ssm-string-parameter-helper.test.ts similarity index 60% rename from source/patterns/@aws-solutions-constructs/core/test/ssm-parameter-helper.test.ts rename to source/patterns/@aws-solutions-constructs/core/test/ssm-string-parameter-helper.test.ts index 4bfbcc62a..12ef59101 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/ssm-parameter-helper.test.ts +++ b/source/patterns/@aws-solutions-constructs/core/test/ssm-string-parameter-helper.test.ts @@ -15,6 +15,7 @@ import {Stack} from '@aws-cdk/core'; import * as defaults from '../'; import {SynthUtils} from '@aws-cdk/assert'; import '@aws-cdk/assert/jest'; +import {ParameterType} from '@aws-cdk/aws-ssm'; // -------------------------------------------------------------- // Test minimal deployment with no properties @@ -24,7 +25,29 @@ test('Test minimal deployment with required properties', () => { const stack = new Stack(); // Helper declaration const parameterValue = "test-val"; - defaults.buildSsmStringParamter(stack, 'parameterName', { stringValue: parameterValue }); + defaults.buildSsmStringParameter(stack, 'parameterName', {stringValue: parameterValue}); + // Assertion 1 + expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); + // Assertion 2 + expect(stack).toHaveResourceLike('AWS::SSM::Parameter', { + Type: 'String', + Value: parameterValue + }); +}); + +// -------------------------------------------------------------- +// Test minimal deployment overriding parameter type +// -------------------------------------------------------------- +test('Test minimal deployment with required properties', () => { + // Stack + const stack = new Stack(); + // Helper declaration + const parameterValue = "test-val"; + defaults.buildSsmStringParameter(stack, 'parameterName', + { + stringValue: parameterValue, + type: ParameterType.STRING_LIST, + }); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); // Assertion 2