Skip to content

Commit f513a50

Browse files
authored
Merge branch 'master' into automation/yarn-upgrade
2 parents c530aeb + bb8d6f6 commit f513a50

File tree

242 files changed

+3785
-528
lines changed

Some content is hidden

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

242 files changed

+3785
-528
lines changed

Diff for: CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
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+
## [1.143.0](https://github.com/aws/aws-cdk/compare/v1.142.0...v1.143.0) (2022-02-02)
6+
7+
8+
### Features
9+
10+
* **amplify:** support performance mode in Branch ([#18598](https://github.com/aws/aws-cdk/issues/18598)) ([bdeb8eb](https://github.com/aws/aws-cdk/commit/bdeb8eb604f5012ce3180d2f6d887fed1834e4f4)), closes [#18557](https://github.com/aws/aws-cdk/issues/18557)
11+
* **cfnspec:** cloudformation spec v54.0.0 ([#18764](https://github.com/aws/aws-cdk/issues/18764)) ([71601c1](https://github.com/aws/aws-cdk/commit/71601c115a6460b4532a34c83100ae70a476fad2))
12+
* **cloudwatch-actions:** add ssm opsitem action for cloudwatch alarm ([#16923](https://github.com/aws/aws-cdk/issues/16923)) ([9380885](https://github.com/aws/aws-cdk/commit/93808851415bff269418f28d9de3c61727e143d3)), closes [#16861](https://github.com/aws/aws-cdk/issues/16861)
13+
* **dynamodb:** allow setting TableClass for a Table ([#18719](https://github.com/aws/aws-cdk/issues/18719)) ([73a889e](https://github.com/aws/aws-cdk/commit/73a889eba85d0aa542ac96a1124f3ae4f1d351bc)), closes [#18718](https://github.com/aws/aws-cdk/issues/18718)
14+
* **ec2:** support KMS keys for block device mappings for both instances and launch templates ([#18326](https://github.com/aws/aws-cdk/issues/18326)) ([17dbe5f](https://github.com/aws/aws-cdk/commit/17dbe5f476ac1ccc0c0e6a0905b0de5ae6186704)), closes [#18309](https://github.com/aws/aws-cdk/issues/18309)
15+
* **ecr:** add server-side encryption configuration ([#16966](https://github.com/aws/aws-cdk/issues/16966)) ([c46acd5](https://github.com/aws/aws-cdk/commit/c46acd5f13442c43d0c2ed339e3091dd46002741)), closes [#15400](https://github.com/aws/aws-cdk/issues/15400) [#15571](https://github.com/aws/aws-cdk/issues/15571)
16+
* **ecs:** expose image name in container definition ([#17793](https://github.com/aws/aws-cdk/issues/17793)) ([1947d7c](https://github.com/aws/aws-cdk/commit/1947d7cc809fda0765bee3dbb2286190ec2847f7))
17+
* **fsx:** add support for FSx Lustre Persistent_2 deployment type ([#18626](https://github.com/aws/aws-cdk/issues/18626)) ([6036d99](https://github.com/aws/aws-cdk/commit/6036d9927bb3607e31a57361bf304976ff1891f7))
18+
* **iot:** add Action to republish MQTT messages to another MQTT topic ([#18661](https://github.com/aws/aws-cdk/issues/18661)) ([7ac1215](https://github.com/aws/aws-cdk/commit/7ac121546776cae972bbfb89c2a11949762e7c47))
19+
20+
21+
### Bug Fixes
22+
23+
* **core:** correctly reference versionless secure parameters ([#18730](https://github.com/aws/aws-cdk/issues/18730)) ([9f6e10e](https://github.com/aws/aws-cdk/commit/9f6e10ed0a751c06fe0cc1d79f38d5fb4b686087)), closes [#18729](https://github.com/aws/aws-cdk/issues/18729)
24+
* **ec2:** `UserData.addSignalOnExitCommand` does not work in combination with `userDataCausesReplacement` ([#18726](https://github.com/aws/aws-cdk/issues/18726)) ([afdc550](https://github.com/aws/aws-cdk/commit/afdc550ee372dd25d9d2eef81a545da1e923f796)), closes [#12749](https://github.com/aws/aws-cdk/issues/12749)
25+
* **vpc:** Vpc.fromLookup should throw if subnet group name tag is explicitly given and does not exist ([#18714](https://github.com/aws/aws-cdk/issues/18714)) ([13e1c7f](https://github.com/aws/aws-cdk/commit/13e1c7f10b81fc350953fe69fcccb61ff5aa9c1e)), closes [#13962](https://github.com/aws/aws-cdk/issues/13962)
26+
27+
28+
### Reverts
29+
30+
* "chore(cloudfront): encryption and enforceSSL on distribution s3 loggingBucket ([#18264](https://github.com/aws/aws-cdk/issues/18264))" ([#18772](https://github.com/aws/aws-cdk/issues/18772)) ([121e4a1](https://github.com/aws/aws-cdk/commit/121e4a1dec13d31644f6176d0a1d703952dc1ba3)), closes [#18271](https://github.com/aws/aws-cdk/issues/18271) [/docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-S3](https://github.com/aws//docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html/issues/AWS-logs-infrastructure-S3) [#18676](https://github.com/aws/aws-cdk/issues/18676)
31+
* "chore(ec2): enforceSSL on flowLog s3 bucket ([#18271](https://github.com/aws/aws-cdk/issues/18271))" ([#18770](https://github.com/aws/aws-cdk/issues/18770)) ([a2eb092](https://github.com/aws/aws-cdk/commit/a2eb092b2b468bffa2acde9b98ca34cefa3e48f1)), closes [/docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-S3](https://github.com/aws//docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html/issues/AWS-logs-infrastructure-S3) [#18676](https://github.com/aws/aws-cdk/issues/18676)
32+
533
## [1.142.0](https://github.com/aws/aws-cdk/compare/v1.141.0...v1.142.0) (2022-01-28)
634

735

Diff for: packages/@aws-cdk/aws-appsync/lib/data-source.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ export abstract class BaseDataSource extends CoreConstruct {
111111
if (extended.type !== 'NONE') {
112112
this.serviceRole = props.serviceRole || new Role(this, 'ServiceRole', { assumedBy: new ServicePrincipal('appsync') });
113113
}
114-
const name = props.name ?? id;
114+
// Replace unsupported characters from DataSource name. The only allowed pattern is: {[_A-Za-z][_0-9A-Za-z]*}
115+
const name = (props.name ?? id).replace(/[\W]+/g, '');
115116
this.ds = new CfnDataSource(this, 'Resource', {
116117
apiId: props.api.apiId,
117118
name: name,

Diff for: packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts

+36
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,42 @@ describe('Lambda Data Source configuration', () => {
6565
});
6666
});
6767

68+
test('appsync sanitized datasource name from unsupported characters', () => {
69+
const badCharacters = [...'!@#$%^&*()+-=[]{}\\|;:\'",<>?/'];
70+
71+
badCharacters.forEach((badCharacter) => {
72+
// WHEN
73+
const newStack = new cdk.Stack();
74+
const graphqlapi = new appsync.GraphqlApi(newStack, 'baseApi', {
75+
name: 'api',
76+
schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')),
77+
});
78+
const dummyFunction = new lambda.Function(newStack, 'func', {
79+
code: lambda.Code.fromAsset(path.join(__dirname, 'verify/iam-query')),
80+
handler: 'iam-query.handler',
81+
runtime: lambda.Runtime.NODEJS_12_X,
82+
});
83+
graphqlapi.addLambdaDataSource(`data-${badCharacter}-source`, dummyFunction);
84+
85+
// THEN
86+
Template.fromStack(newStack).hasResourceProperties('AWS::AppSync::DataSource', {
87+
Type: 'AWS_LAMBDA',
88+
Name: 'datasource',
89+
});
90+
});
91+
});
92+
93+
test('appsync leaves underscore untouched in datasource name', () => {
94+
// WHEN
95+
api.addLambdaDataSource('data_source', func);
96+
97+
// THEN
98+
Template.fromStack(stack).hasResourceProperties('AWS::AppSync::DataSource', {
99+
Type: 'AWS_LAMBDA',
100+
Name: 'data_source',
101+
});
102+
});
103+
68104
test('appsync errors when creating multiple lambda data sources with no configuration', () => {
69105
// THEN
70106
expect(() => {

Diff for: packages/@aws-cdk/aws-iotevents/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,16 @@ new iotevents.DetectorModel(this, 'MyDetectorModel', {
7070
initialState: onlineState,
7171
});
7272
```
73+
74+
To grant permissions to put messages in the input,
75+
you can use the `grantWrite()` method:
76+
77+
```ts
78+
import * as iam from '@aws-cdk/aws-iam';
79+
import * as iotevents from '@aws-cdk/aws-iotevents';
80+
81+
declare const grantable: iam.IGrantable;
82+
const input = iotevents.Input.fromInputName(this, 'MyInput', 'my_input');
83+
84+
input.grantWrite(grantable);
85+
```

Diff for: packages/@aws-cdk/aws-iotevents/lib/detector-model.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CfnDetectorModel } from './iotevents.generated';
55
import { State } from './state';
66

77
/**
8-
* Represents an AWS IoT Events detector model
8+
* Represents an AWS IoT Events detector model.
99
*/
1010
export interface IDetectorModel extends IResource {
1111
/**
@@ -33,7 +33,7 @@ export enum EventEvaluation {
3333
}
3434

3535
/**
36-
* Properties for defining an AWS IoT Events detector model
36+
* Properties for defining an AWS IoT Events detector model.
3737
*/
3838
export interface DetectorModelProps {
3939
/**

Diff for: packages/@aws-cdk/aws-iotevents/lib/expression.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { IInput } from './input';
22

33
/**
4-
* Expression for events in Detector Model state
4+
* Expression for events in Detector Model state.
55
* @see https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-expressions.html
66
*/
77
export abstract class Expression {
88
/**
9-
* Create a expression from the given string
9+
* Create a expression from the given string.
1010
*/
1111
public static fromString(value: string): Expression {
1212
return new StringExpression(value);
@@ -28,14 +28,14 @@ export abstract class Expression {
2828
}
2929

3030
/**
31-
* Create a expression for the Equal operator
31+
* Create a expression for the Equal operator.
3232
*/
3333
public static eq(left: Expression, right: Expression): Expression {
3434
return new BinaryOperationExpression(left, '==', right);
3535
}
3636

3737
/**
38-
* Create a expression for the AND operator
38+
* Create a expression for the AND operator.
3939
*/
4040
public static and(left: Expression, right: Expression): Expression {
4141
return new BinaryOperationExpression(left, '&&', right);
@@ -45,7 +45,7 @@ export abstract class Expression {
4545
}
4646

4747
/**
48-
* this is called to evaluate the expression
48+
* This is called to evaluate the expression.
4949
*/
5050
public abstract evaluate(): string;
5151
}

Diff for: packages/@aws-cdk/aws-iotevents/lib/input.ts

+67-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,66 @@
1-
import { Resource, IResource } from '@aws-cdk/core';
1+
import * as iam from '@aws-cdk/aws-iam';
2+
import { Resource, IResource, Aws } from '@aws-cdk/core';
23
import { Construct } from 'constructs';
34
import { CfnInput } from './iotevents.generated';
45

56
/**
6-
* Represents an AWS IoT Events input
7+
* Represents an AWS IoT Events input.
78
*/
89
export interface IInput extends IResource {
910
/**
10-
* The name of the input
11+
* The name of the input.
12+
*
1113
* @attribute
1214
*/
1315
readonly inputName: string;
16+
17+
/**
18+
* The ARN of the input.
19+
*
20+
* @attribute
21+
*/
22+
readonly inputArn: string;
23+
24+
/**
25+
* Grant write permissions on this input and its contents to an IAM principal (Role/Group/User).
26+
*
27+
* @param grantee the principal
28+
*/
29+
grantWrite(grantee: iam.IGrantable): iam.Grant
30+
31+
/**
32+
* Grant the indicated permissions on this input to the given IAM principal (Role/Group/User).
33+
*
34+
* @param grantee the principal
35+
* @param actions the set of actions to allow (i.e. "iotevents:BatchPutMessage")
36+
*/
37+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant
38+
}
39+
40+
abstract class InputBase extends Resource implements IInput {
41+
public abstract readonly inputName: string;
42+
43+
public abstract readonly inputArn: string;
44+
45+
public grantWrite(grantee: iam.IGrantable) {
46+
return this.grant(grantee, 'iotevents:BatchPutMessage');
47+
}
48+
49+
public grant(grantee: iam.IGrantable, ...actions: string[]) {
50+
return iam.Grant.addToPrincipal({
51+
grantee,
52+
actions,
53+
resourceArns: [this.inputArn],
54+
});
55+
}
1456
}
1557

1658
/**
17-
* Properties for defining an AWS IoT Events input
59+
* Properties for defining an AWS IoT Events input.
1860
*/
1961
export interface InputProps {
2062
/**
21-
* The name of the input
63+
* The name of the input.
2264
*
2365
* @default - CloudFormation will generate a unique name of the input
2466
*/
@@ -37,19 +79,25 @@ export interface InputProps {
3779
/**
3880
* Defines an AWS IoT Events input in this stack.
3981
*/
40-
export class Input extends Resource implements IInput {
82+
export class Input extends InputBase {
4183
/**
42-
* Import an existing input
84+
* Import an existing input.
4385
*/
4486
public static fromInputName(scope: Construct, id: string, inputName: string): IInput {
45-
class Import extends Resource implements IInput {
87+
return new class Import extends InputBase {
4688
public readonly inputName = inputName;
47-
}
48-
return new Import(scope, id);
89+
public readonly inputArn = this.stack.formatArn({
90+
service: 'iotevents',
91+
resource: 'input',
92+
resourceName: inputName,
93+
});
94+
}(scope, id);
4995
}
5096

5197
public readonly inputName: string;
5298

99+
public readonly inputArn: string;
100+
53101
constructor(scope: Construct, id: string, props: InputProps) {
54102
super(scope, id, {
55103
physicalName: props.inputName,
@@ -67,5 +115,14 @@ export class Input extends Resource implements IInput {
67115
});
68116

69117
this.inputName = this.getResourceNameAttribute(resource.ref);
118+
this.inputArn = this.getResourceArnAttribute(arnForInput(resource.ref), {
119+
service: 'iotevents',
120+
resource: 'input',
121+
resourceName: this.physicalName,
122+
});
70123
}
71124
}
125+
126+
function arnForInput(inputName: string): string {
127+
return `arn:${Aws.PARTITION}:iotevents:${Aws.REGION}:${Aws.ACCOUNT_ID}:input/${inputName}`;
128+
}

Diff for: packages/@aws-cdk/aws-iotevents/lib/state.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Event } from './event';
22
import { CfnDetectorModel } from './iotevents.generated';
33

44
/**
5-
* Properties for defining a state of a detector
5+
* Properties for defining a state of a detector.
66
*/
77
export interface StateProps {
88
/**
@@ -20,11 +20,11 @@ export interface StateProps {
2020
}
2121

2222
/**
23-
* Defines a state of a detector
23+
* Defines a state of a detector.
2424
*/
2525
export class State {
2626
/**
27-
* The name of the state
27+
* The name of the state.
2828
*/
2929
public readonly stateName: string;
3030

@@ -33,7 +33,7 @@ export class State {
3333
}
3434

3535
/**
36-
* Return the state property JSON
36+
* Return the state property JSON.
3737
*
3838
* @internal
3939
*/
@@ -46,7 +46,7 @@ export class State {
4646
}
4747

4848
/**
49-
* returns true if this state has at least one condition via events
49+
* Returns true if this state has at least one condition via events.
5050
*
5151
* @internal
5252
*/

0 commit comments

Comments
 (0)