cloudcomponents / cdk-constructs

A collection of higher-level reusable cdk constructs
MIT License
623 stars 101 forks source link

Support CodeDeploy Application references instead of managing Application props #167

Closed cuperman closed 2 years ago

cuperman commented 2 years ago

EcsDeploymentGroup supports new prop application, which allows multiple Deployment Groups in the same stack to be associated to the same CodeDeploy Application.

Example:

const application = new codedeploy.EcsApplication(stack, 'Application', {
  applicationName: 'blue-green-application',
});

new EcsDeploymentGroup(this, 'ServiceADeploymentGroup', {
  application,
  deploymentGroupName: 'service-a-deployment-group',
  ecsServices: [serviceA],
  // ...
});

new EcsDeploymentGroup(this, 'ServiceBDeploymentGroup', {
  application,
  deploymentGroupName: 'service-b-deployment-group',
  ecsServices: [serviceB],
  // ...
});

For backwards compatibility, it also supports deprecated applicationName prop:

new EcsDeploymentGroup(this, 'DeploymentGroup', {
  applicationName: 'blue-green-application',
  deploymentGroupName: 'blue-green-deployment-group',
  ecsServices: [ecsService],
  // ...
});

Resolves #166