Skip to content

Commit 85e2735

Browse files
authored
2 parents 9329a73 + a1370a0 commit 85e2735

File tree

289 files changed

+6027
-841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+6027
-841
lines changed

CHANGELOG.v2.alpha.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.57.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.56.1-alpha.0...v2.57.0-alpha.0) (2022-12-27)
6+
7+
8+
### Bug Fixes
9+
10+
* **aws-redshift:** Columns are not dropped on removal from array ([#23011](https://github.com/aws/aws-cdk/issues/23011)) ([2981313](https://github.com/aws/aws-cdk/commit/298131312b513c0e73865e6fff74c189ee99e328)), closes [#22208](https://github.com/aws/aws-cdk/issues/22208)
11+
512
## [2.56.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.56.0-alpha.0...v2.56.1-alpha.0) (2022-12-23)
613

714
## [2.56.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.55.1-alpha.0...v2.56.0-alpha.0) (2022-12-21)

CHANGELOG.v2.md

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.57.0](https://github.com/aws/aws-cdk/compare/v2.56.1...v2.57.0) (2022-12-27)
6+
7+
8+
### Features
9+
10+
* **cfnspec:** cloudformation spec v103.0.0 ([#23452](https://github.com/aws/aws-cdk/issues/23452)) ([e49e57d](https://github.com/aws/aws-cdk/commit/e49e57d3106f62c5d64c428cba73b4107d664cba))
11+
* **lambda:** add support for auto-instrumentation with ADOT Lambda layer ([#23027](https://github.com/aws/aws-cdk/issues/23027)) ([fc70535](https://github.com/aws/aws-cdk/commit/fc70535fe699e72332d5ddb4543308e76a89594a))
12+
13+
14+
### Bug Fixes
15+
16+
* **cfnspec:** v101.0.0 introduced specific types on several types that previously were typed as json ([#23448](https://github.com/aws/aws-cdk/issues/23448)) ([4fbc182](https://github.com/aws/aws-cdk/commit/4fbc1827b8978262da0b5b77b1ee9bc0ecfdcc3e))
17+
* **codedeploy:** referenced Applications are not environment-aware ([#23405](https://github.com/aws/aws-cdk/issues/23405)) ([96242d7](https://github.com/aws/aws-cdk/commit/96242d73c0ae853524a567aece86f8a8a514495c))
18+
* **s3:** buckets with SSE-KMS silently fail to receive logs ([#23385](https://github.com/aws/aws-cdk/issues/23385)) ([1b7a384](https://github.com/aws/aws-cdk/commit/1b7a384c330d168d64c0cd82118e5b5473d08a67))
19+
520
## [2.56.1](https://github.com/aws/aws-cdk/compare/v2.56.0...v2.56.1) (2022-12-23)
621

722

packages/@aws-cdk/aws-apigatewayv2/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ const certArn = 'arn:aws:acm:us-east-1:111111111111:certificate';
184184
const domainName = 'example.com';
185185

186186
const dn = new apigwv2.DomainName(this, 'DN', {
187-
domainName,
187+
domainName: domainName,
188188
certificate: acm.Certificate.fromCertificateArn(this, 'cert', certArn),
189189
});
190190

packages/@aws-cdk/aws-codedeploy/lib/base-deployment-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { ArnFormat, Resource, Stack } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { CfnDeploymentConfig } from './codedeploy.generated';
44
import { MinimumHealthyHosts } from './host-health-config';
5+
import { arnForDeploymentConfig, validateName } from './private/utils';
56
import { TrafficRouting } from './traffic-routing-config';
6-
import { arnForDeploymentConfig, validateName } from './utils';
77

88
/**
99
* The base class for ServerDeploymentConfig, EcsDeploymentConfig,

packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { ArnFormat, IResource, Resource } from '@aws-cdk/core';
1+
import { ArnFormat, IResource, Resource, Stack, Arn } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { CfnApplication } from '../codedeploy.generated';
4-
import { arnForApplication, validateName } from '../utils';
4+
import { arnForApplication, validateName } from '../private/utils';
55

66
/**
77
* Represents a reference to a CodeDeploy Application deploying to Amazon ECS.
@@ -42,20 +42,38 @@ export class EcsApplication extends Resource implements IEcsApplication {
4242
/**
4343
* Import an Application defined either outside the CDK, or in a different CDK Stack.
4444
*
45+
* The Application's account and region are assumed to be the same as the stack it is being imported
46+
* into. If not, use `fromEcsApplicationArn`.
47+
*
4548
* @param scope the parent Construct for this new Construct
4649
* @param id the logical ID of this new Construct
4750
* @param ecsApplicationName the name of the application to import
4851
* @returns a Construct representing a reference to an existing Application
4952
*/
5053
public static fromEcsApplicationName(scope: Construct, id: string, ecsApplicationName: string): IEcsApplication {
5154
class Import extends Resource implements IEcsApplication {
52-
public applicationArn = arnForApplication(ecsApplicationName);
55+
public applicationArn = arnForApplication(Stack.of(scope), ecsApplicationName);
5356
public applicationName = ecsApplicationName;
5457
}
5558

5659
return new Import(scope, id);
5760
}
5861

62+
/**
63+
* Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN.
64+
*
65+
* @param scope the parent Construct for this new Construct
66+
* @param id the logical ID of this new Construct
67+
* @param ecsApplicationArn the ARN of the application to import
68+
* @returns a Construct representing a reference to an existing Application
69+
*/
70+
public static fromEcsApplicationArn(scope: Construct, id: string, ecsApplicationArn: string): IEcsApplication {
71+
return new class extends Resource implements IEcsApplication {
72+
public applicationArn = ecsApplicationArn;
73+
public applicationName = Arn.split(ecsApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? '<invalid arn>';
74+
} (scope, id, { environmentFromArn: ecsApplicationArn });
75+
}
76+
5977
public readonly applicationArn: string;
6078
public readonly applicationName: string;
6179

@@ -70,7 +88,7 @@ export class EcsApplication extends Resource implements IEcsApplication {
7088
});
7189

7290
this.applicationName = this.getResourceNameAttribute(resource.ref);
73-
this.applicationArn = this.getResourceArnAttribute(arnForApplication(resource.ref), {
91+
this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(scope), resource.ref), {
7492
service: 'codedeploy',
7593
resource: 'application',
7694
resourceName: this.physicalName,

packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Construct } from 'constructs';
22
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, ComputePlatform, IBaseDeploymentConfig } from '../base-deployment-config';
3+
import { deploymentConfig } from '../private/utils';
34
import { TrafficRouting } from '../traffic-routing-config';
4-
import { deploymentConfig } from '../utils';
55

66
/**
77
* The Deployment Configuration of an ECS Deployment Group.

packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts

+18-26
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import * as iam from '@aws-cdk/aws-iam';
55
import * as cdk from '@aws-cdk/core';
66
import { Construct } from 'constructs';
77
import { CfnDeploymentGroup } from '../codedeploy.generated';
8+
import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group';
9+
import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils';
810
import { AutoRollbackConfig } from '../rollback-config';
9-
import { arnForDeploymentGroup, renderAlarmConfiguration, renderAutoRollbackConfiguration, validateName } from '../utils';
1011
import { IEcsApplication, EcsApplication } from './application';
1112
import { EcsDeploymentConfig, IEcsDeploymentConfig } from './deployment-config';
1213

@@ -182,9 +183,11 @@ export interface EcsDeploymentGroupProps {
182183
* A CodeDeploy deployment group that orchestrates ECS blue-green deployments.
183184
* @resource AWS::CodeDeploy::DeploymentGroup
184185
*/
185-
export class EcsDeploymentGroup extends cdk.Resource implements IEcsDeploymentGroup {
186+
export class EcsDeploymentGroup extends DeploymentGroupBase implements IEcsDeploymentGroup {
186187
/**
187-
* Import an ECS Deployment Group defined outside the CDK app.
188+
* Reference an ECS Deployment Group defined outside the CDK app.
189+
*
190+
* Account and region for the DeploymentGroup are taken from the application.
188191
*
189192
* @param scope the parent Construct for this new Construct
190193
* @param id the logical ID of this new Construct
@@ -199,8 +202,6 @@ export class EcsDeploymentGroup extends cdk.Resource implements IEcsDeploymentGr
199202
}
200203

201204
public readonly application: IEcsApplication;
202-
public readonly deploymentGroupName: string;
203-
public readonly deploymentGroupArn: string;
204205
public readonly deploymentConfig: IEcsDeploymentConfig;
205206
/**
206207
* The service Role of this Deployment Group.
@@ -211,16 +212,15 @@ export class EcsDeploymentGroup extends cdk.Resource implements IEcsDeploymentGr
211212

212213
constructor(scope: Construct, id: string, props: EcsDeploymentGroupProps) {
213214
super(scope, id, {
214-
physicalName: props.deploymentGroupName,
215+
deploymentGroupName: props.deploymentGroupName,
216+
role: props.role,
217+
roleConstructId: 'ServiceRole',
215218
});
219+
this.role = this._role;
216220

217221
this.application = props.application || new EcsApplication(this, 'Application');
218222
this.alarms = props.alarms || [];
219223

220-
this.role = props.role || new iam.Role(this, 'ServiceRole', {
221-
assumedBy: new iam.ServicePrincipal('codedeploy.amazonaws.com'),
222-
});
223-
224224
this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AWSCodeDeployRoleForECS'));
225225
this.deploymentConfig = props.deploymentConfig || EcsDeploymentConfig.ALL_AT_ONCE;
226226

@@ -261,21 +261,13 @@ export class EcsDeploymentGroup extends cdk.Resource implements IEcsDeploymentGr
261261
autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }),
262262
});
263263

264-
this.deploymentGroupName = this.getResourceNameAttribute(resource.ref);
265-
this.deploymentGroupArn = this.getResourceArnAttribute(arnForDeploymentGroup(this.application.applicationName, resource.ref), {
266-
service: 'codedeploy',
267-
resource: 'deploymentgroup',
268-
resourceName: `${this.application.applicationName}/${this.physicalName}`,
269-
arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME,
270-
});
264+
this._setNameAndArn(resource, this.application);
271265

272266
// If the deployment config is a construct, add a dependency to ensure the deployment config
273267
// is created before the deployment group is.
274268
if (Construct.isConstruct(this.deploymentConfig)) {
275269
this.node.addDependency(this.deploymentConfig);
276270
}
277-
278-
this.node.addValidation({ validate: () => validateName('Deployment group', this.physicalName) });
279271
}
280272

281273
/**
@@ -355,17 +347,17 @@ export interface EcsDeploymentGroupAttributes {
355347
readonly deploymentConfig?: IEcsDeploymentConfig;
356348
}
357349

358-
class ImportedEcsDeploymentGroup extends cdk.Resource implements IEcsDeploymentGroup {
350+
class ImportedEcsDeploymentGroup extends ImportedDeploymentGroupBase implements IEcsDeploymentGroup {
359351
public readonly application: IEcsApplication;
360-
public readonly deploymentGroupName: string;
361-
public readonly deploymentGroupArn: string;
362352
public readonly deploymentConfig: IEcsDeploymentConfig;
363353

364-
constructor(scope:Construct, id: string, props: EcsDeploymentGroupAttributes) {
365-
super(scope, id);
354+
constructor(scope: Construct, id: string, props: EcsDeploymentGroupAttributes) {
355+
super(scope, id, {
356+
application: props.application,
357+
deploymentGroupName: props.deploymentGroupName,
358+
});
359+
366360
this.application = props.application;
367-
this.deploymentGroupName = props.deploymentGroupName;
368-
this.deploymentGroupArn = arnForDeploymentGroup(props.application.applicationName, props.deploymentGroupName);
369361
this.deploymentConfig = props.deploymentConfig || EcsDeploymentConfig.ALL_AT_ONCE;
370362
}
371363
}

packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { ArnFormat, IResource, Resource } from '@aws-cdk/core';
1+
import { ArnFormat, IResource, Resource, Stack, Arn } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { CfnApplication } from '../codedeploy.generated';
4-
import { arnForApplication, validateName } from '../utils';
4+
import { arnForApplication, validateName } from '../private/utils';
55

66
/**
77
* Represents a reference to a CodeDeploy Application deploying to AWS Lambda.
@@ -42,20 +42,38 @@ export class LambdaApplication extends Resource implements ILambdaApplication {
4242
/**
4343
* Import an Application defined either outside the CDK, or in a different CDK Stack.
4444
*
45+
* The Application's account and region are assumed to be the same as the stack it is being imported
46+
* into. If not, use `fromLambdaApplicationArn`.
47+
*
4548
* @param scope the parent Construct for this new Construct
4649
* @param id the logical ID of this new Construct
4750
* @param lambdaApplicationName the name of the application to import
4851
* @returns a Construct representing a reference to an existing Application
4952
*/
5053
public static fromLambdaApplicationName(scope: Construct, id: string, lambdaApplicationName: string): ILambdaApplication {
5154
class Import extends Resource implements ILambdaApplication {
52-
public applicationArn = arnForApplication(lambdaApplicationName);
55+
public applicationArn = arnForApplication(Stack.of(scope), lambdaApplicationName);
5356
public applicationName = lambdaApplicationName;
5457
}
5558

5659
return new Import(scope, id);
5760
}
5861

62+
/**
63+
* Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN.
64+
*
65+
* @param scope the parent Construct for this new Construct
66+
* @param id the logical ID of this new Construct
67+
* @param lambdaApplicationArn the ARN of the application to import
68+
* @returns a Construct representing a reference to an existing Application
69+
*/
70+
public static fromLambdaApplicationArn(scope: Construct, id: string, lambdaApplicationArn: string): ILambdaApplication {
71+
return new class extends Resource implements ILambdaApplication {
72+
public applicationArn = lambdaApplicationArn;
73+
public applicationName = Arn.split(lambdaApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? '<invalid arn>';
74+
}(scope, id, { environmentFromArn: lambdaApplicationArn });
75+
}
76+
5977
public readonly applicationArn: string;
6078
public readonly applicationName: string;
6179

@@ -70,7 +88,7 @@ export class LambdaApplication extends Resource implements ILambdaApplication {
7088
});
7189

7290
this.applicationName = this.getResourceNameAttribute(resource.ref);
73-
this.applicationArn = this.getResourceArnAttribute(arnForApplication(resource.ref), {
91+
this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(this), resource.ref), {
7492
service: 'codedeploy',
7593
resource: 'application',
7694
resourceName: this.physicalName,

packages/@aws-cdk/aws-codedeploy/lib/lambda/custom-deployment-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Duration, Names, Resource } from '@aws-cdk/core';
22
import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '@aws-cdk/custom-resources';
33
import { Construct } from 'constructs';
4-
import { arnForDeploymentConfig, validateName } from '../utils';
4+
import { arnForDeploymentConfig, validateName } from '../private/utils';
55
import { ILambdaDeploymentConfig } from './deployment-config';
66

77
/**

packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Construct } from 'constructs';
22
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, ComputePlatform, IBaseDeploymentConfig } from '../base-deployment-config';
3+
import { deploymentConfig } from '../private/utils';
34
import { TrafficRouting } from '../traffic-routing-config';
4-
import { deploymentConfig } from '../utils';
55

66
/**
77
* The Deployment Configuration of a Lambda Deployment Group.

0 commit comments

Comments
 (0)