From 198c2e59457cec09ad643d09b655501b106936bc Mon Sep 17 00:00:00 2001 From: BLasan Date: Sun, 14 Mar 2021 13:37:07 +0530 Subject: [PATCH] fix(aws-codedeploy): implicitly create application in ServerDeploymentGroup fixes #13337 --- .../aws-codedeploy/lib/server/deployment-group.ts | 2 +- .../test/server/test.deployment-group.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts index 32a3ccb3e40d1..7f6154bea8e92 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts @@ -269,7 +269,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase { physicalName: props.deploymentGroupName, }); - this.application = props.application || new ServerApplication(this, 'Application'); + this.application = props.application || new ServerApplication(this, this.physicalName); this.role = props.role || new iam.Role(this, 'Role', { assumedBy: new iam.ServicePrincipal('codedeploy.amazonaws.com'), diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts index aebb3aa8a074f..1c05cfb0f43b5 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts @@ -28,6 +28,18 @@ export = { test.done(); }, + 'with creating an application implicitly'(test: Test) { + const stack = new cdk.Stack(); + + const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'MyDG', + }); + + test.notEqual(deploymentGroup, undefined); + + test.done(); + }, + 'can be imported'(test: Test) { const stack = new cdk.Stack(); @@ -38,7 +50,7 @@ export = { }); test.notEqual(deploymentGroup, undefined); - + test.done(); },