Skip to content

Commit

Permalink
Merge branch 'master' into conroy/update-lambda-resource-policies
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Mar 31, 2022
2 parents f974469 + ff85fd1 commit 0fc25bd
Show file tree
Hide file tree
Showing 137 changed files with 6,246 additions and 501 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: pr-labeler
on:
pull_request:
pull_request_target:
types:
- opened
- edited
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
}}/upgrade.patch || echo "Empty patch. Skipping."'

- name: Make Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
# Git commit details
branch: automation/yarn-upgrade
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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.

## [1.150.0](https://github.com/aws/aws-cdk/compare/v1.149.0...v1.150.0) (2022-03-26)


### Features

* cloudformation spec v62.0.0 ([#19553](https://github.com/aws/aws-cdk/issues/19553)) ([0352dee](https://github.com/aws/aws-cdk/commit/0352deedb445f070ed0cd27406a75872fb71ea53))
* **appsync:** support custom domain mappings ([#19368](https://github.com/aws/aws-cdk/issues/19368)) ([8c7a4ac](https://github.com/aws/aws-cdk/commit/8c7a4acbd58975a8f1c4e4ca180ca9a3ea2c750d)), closes [#18040](https://github.com/aws/aws-cdk/issues/18040)
* **autoscaling:** support warm pools ([#19214](https://github.com/aws/aws-cdk/issues/19214)) ([737e611](https://github.com/aws/aws-cdk/commit/737e611577c97b6ad01eaeb05fc544258a9de5ad))
* **cfnspec:** cloudformation spec v61.0.0 ([#19457](https://github.com/aws/aws-cdk/issues/19457)) ([16d7552](https://github.com/aws/aws-cdk/commit/16d7552683ea05ea1a24b214b925836dcb72871d))
* **cli:** support SSO ([#19454](https://github.com/aws/aws-cdk/issues/19454)) ([eba6052](https://github.com/aws/aws-cdk/commit/eba6052e1c8011d7163c782e669e86f5d2fd44d0))
* **cloudwatch:** Additional Properties for Cloudwatch AlarmStatusWidget ([#19387](https://github.com/aws/aws-cdk/issues/19387)) ([3c9ea5f](https://github.com/aws/aws-cdk/commit/3c9ea5f31e3113fb0d2ba5c633fcd665294a70eb)), closes [#19386](https://github.com/aws/aws-cdk/issues/19386)
* **ec2:** add support for x2iezn instances ([#19517](https://github.com/aws/aws-cdk/issues/19517)) ([8f6e20e](https://github.com/aws/aws-cdk/commit/8f6e20e5a070fc3ac2c234013b915315a0e7dcfb))
* **synthetics:** add support for puppeteer 3.4 runtime ([#19429](https://github.com/aws/aws-cdk/issues/19429)) ([024b890](https://github.com/aws/aws-cdk/commit/024b890c67392e255ea8e82c1aa58bcc6bcf6f86)), closes [#19382](https://github.com/aws/aws-cdk/issues/19382)


### Bug Fixes

* **apigateway:** `StepFunctionsIntegration` does not create required role and responses ([#19486](https://github.com/aws/aws-cdk/issues/19486)) ([d59bee9](https://github.com/aws/aws-cdk/commit/d59bee99768b20427503853eb2ec436959ae7e6f))
* **bootstrap:** rebootstrap breaks container Functions ([#19446](https://github.com/aws/aws-cdk/issues/19446)) ([49ea263](https://github.com/aws/aws-cdk/commit/49ea26304760801e03dae5479ae03540eaa63f6e)), closes [#18473](https://github.com/aws/aws-cdk/issues/18473)
* **cli:** templates don't include `.gitignore` ([#19482](https://github.com/aws/aws-cdk/issues/19482)) ([5ce0983](https://github.com/aws/aws-cdk/commit/5ce0983955628c5119340d659abf0201da58bcb6))
* **core:** Aspects from symlinked modules are not applied ([#19491](https://github.com/aws/aws-cdk/issues/19491)) ([eaeaed7](https://github.com/aws/aws-cdk/commit/eaeaed7a508cdb9c84c96911327b085e907aed98)), closes [#18921](https://github.com/aws/aws-cdk/issues/18921) [#18778](https://github.com/aws/aws-cdk/issues/18778) [#19390](https://github.com/aws/aws-cdk/issues/19390) [#18914](https://github.com/aws/aws-cdk/issues/18914)
* **ecr:** setting imageScanningConfiguration to false does nothing on existing repository ([#18078](https://github.com/aws/aws-cdk/issues/18078)) ([78bc870](https://github.com/aws/aws-cdk/commit/78bc8703bb932822ceeb16fd57fa576714aa5732)), closes [#18077](https://github.com/aws/aws-cdk/issues/18077)
* **events:** cannot have more than one cross-account Rule ([#19441](https://github.com/aws/aws-cdk/issues/19441)) ([a257846](https://github.com/aws/aws-cdk/commit/a2578462119d112c6095e06668add97e7721d570)), closes [#12479](https://github.com/aws/aws-cdk/issues/12479) [#12538](https://github.com/aws/aws-cdk/issues/12538)
* **iam:** IAM Policies are too large to deploy ([#19114](https://github.com/aws/aws-cdk/issues/19114)) ([3a4fe33](https://github.com/aws/aws-cdk/commit/3a4fe3304ba32bc205cbf4833f7397f633cc1ece)), closes [#18774](https://github.com/aws/aws-cdk/issues/18774) [#16350](https://github.com/aws/aws-cdk/issues/16350) [#18457](https://github.com/aws/aws-cdk/issues/18457) [#18564](https://github.com/aws/aws-cdk/issues/18564) [#19276](https://github.com/aws/aws-cdk/issues/19276)
* **lambda:** support Lambda's new `Invoke` with `Qualifier` authorization strategy ([#19318](https://github.com/aws/aws-cdk/issues/19318)) ([d06b27f](https://github.com/aws/aws-cdk/commit/d06b27fd4bf351cc9ba5c603352f756c679c34fc)), closes [#19273](https://github.com/aws/aws-cdk/issues/19273)
* **secretsmanager:** secret rotation uses old application versions ([#19490](https://github.com/aws/aws-cdk/issues/19490)) ([0c983ad](https://github.com/aws/aws-cdk/commit/0c983ad748fa57c0717d9bdf852051046f88b3a9)), closes [#19487](https://github.com/aws/aws-cdk/issues/19487)

## [1.149.0](https://github.com/aws/aws-cdk/compare/v1.148.0...v1.149.0) (2022-03-17)


Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.1",
"jest": "^27.5.1",
"ts-jest": "^27.1.3"
"ts-jest": "^27.1.4"
},
"dependencies": {
"@aws-cdk/cloud-assembly-schema": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"aws-cdk-migration": "0.0.0",
"constructs": "^3.3.69",
"jest": "^27.3.1",
"ts-jest": "^27.1.3"
"ts-jest": "^27.1.4"
},
"dependencies": {
"@aws-cdk/cloudformation-diff": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assertions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@types/jest": "^27.4.1",
"constructs": "^3.3.69",
"jest": "^27.5.1",
"ts-jest": "^27.1.3"
"ts-jest": "^27.1.4"
},
"dependencies": {
"@aws-cdk/cloud-assembly-schema": "0.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-apigateway/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export class JsonSchemaMapper {
private static readonly SchemaPropsWithPrefix: { [key: string]: string } = {
schema: '$schema',
ref: '$ref',
id: '$id',
};
// The value indicates whether direct children should be key-mapped.
private static readonly SchemaPropsWithUserDefinedChildren: { [key: string]: boolean } = {
Expand Down
15 changes: 14 additions & 1 deletion packages/@aws-cdk/aws-apigateway/test/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonSchema, JsonSchemaType } from '../lib';
import { JsonSchema, JsonSchemaType, JsonSchemaVersion } from '../lib';
import { JsonSchemaMapper, parseAwsApiCall, parseMethodOptionsPath } from '../lib/util';

describe('util', () => {
Expand Down Expand Up @@ -136,5 +136,18 @@ describe('util', () => {
default: 'blue',
});
});

test('"id" maps to "id" when using DRAFT-04', () => {
const schema: JsonSchema = {
schema: JsonSchemaVersion.DRAFT4,
id: 'http://json-schema.org/draft-04/schema#',
};

const actual = JsonSchemaMapper.toCfnJsonSchema(schema);
expect(actual).toEqual({
$schema: 'http://json-schema.org/draft-04/schema#',
id: 'http://json-schema.org/draft-04/schema#',
});
});
});
});
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-applicationautoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const handler = new lambda.Function(this, 'MyFunction', {
reservedConcurrentExecutions: 2,
});

const fnVer = handler.addVersion('CDKLambdaVersion', undefined, 'demo alias', 10);
const fnVer = handler.currentVersion;

const target = new appscaling.ScalableTarget(this, 'ScalableTarget', {
serviceNamespace: appscaling.ServiceNamespace.LAMBDA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"lambda-tester": "^3.6.0",
"sinon": "^9.2.4",
"nock": "^13.2.4",
"ts-jest": "^27.1.3"
"ts-jest": "^27.1.4"
}
}
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codedeploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ To create a new CodeDeploy Deployment Group that deploys to a Lambda function:
```ts
declare const myApplication: codedeploy.LambdaApplication;
declare const func: lambda.Function;
const version = func.addVersion('1');
const version = func.currentVersion;
const version1Alias = new lambda.Alias(this, 'alias', {
aliasName: 'prod',
version,
Expand All @@ -222,7 +222,7 @@ const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDep

In order to deploy a new version of this function:

1. Increment the version, e.g. `const version = func.addVersion('2')`.
1. Reference the version with the latest changes `const version = func.currentVersion`.
2. Re-deploy the stack (this will trigger a deployment).
3. Monitor the CodeDeploy deployment as traffic shifts between the versions.

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codepipeline-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ const func = new lambda.Function(this, 'Lambda', {
runtime: lambda.Runtime.NODEJS_12_X,
});
// used to make sure each CDK synthesis produces a different Version
const version = func.addVersion('NewVersion');
const version = func.currentVersion;
const alias = new lambda.Alias(this, 'LambdaAlias', {
aliasName: 'Prod',
version,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codepipeline-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@aws-cdk/cx-api": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.180",
"@types/lodash": "^4.14.181",
"jest": "^27.5.1",
"lodash": "^4.17.21"
},
Expand Down
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-cognito/lib/user-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,14 @@ export interface UserPoolProps {
*/
readonly smsRoleExternalId?: string;

/**
* The region to integrate with SNS to send SMS messages
*
* This property will do nothing if SMS configuration is not configured
* @default - The same region as the user pool, with a few exceptions - https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html#user-pool-sms-settings-first-time
*/
readonly snsRegion?: string;

/**
* Setting this would explicitly enable or disable SMS role creation.
* When left unspecified, CDK will determine based on other properties if a role is needed or not.
Expand Down Expand Up @@ -1032,6 +1040,7 @@ export class UserPool extends UserPoolBase {
return {
snsCallerArn: props.smsRole.roleArn,
externalId: props.smsRoleExternalId,
snsRegion: props.snsRegion,
};
}

Expand Down Expand Up @@ -1072,6 +1081,7 @@ export class UserPool extends UserPoolBase {
return {
externalId: smsRoleExternalId,
snsCallerArn: smsRole.roleArn,
snsRegion: props.snsRegion,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,9 @@
"myuserpoolsmsRole0E16FDD9",
"Arn"
]
},
"SnsRegion": {
"Ref": "AWS::Region"
}
},
"SmsVerificationMessage": "verification sms message from the integ test. Code is {####}.",
Expand All @@ -850,7 +853,7 @@
"myuserpoolmyuserpooldomainEE1E11AF": {
"Type": "AWS::Cognito::UserPoolDomain",
"Properties": {
"Domain": "myawesomeapp",
"Domain": "cdkintegrationtestuserpoolexplicitprops",
"UserPoolId": {
"Ref": "myuserpool01998219"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ const userpool = new UserPool(stack, 'myuserpool', {
userMigration: dummyTrigger('userMigration'),
verifyAuthChallengeResponse: dummyTrigger('verifyAuthChallengeResponse'),
},
snsRegion: Stack.of(stack).region,
});

const cognitoDomain = userpool.addDomain('myuserpooldomain', {
cognitoDomain: {
domainPrefix: 'myawesomeapp',
domainPrefix: 'cdkintegrationtestuserpoolexplicitprops',
},
});

Expand Down
22 changes: 22 additions & 0 deletions packages/@aws-cdk/aws-cognito/test/user-pool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,28 @@ describe('User Pool', () => {
});
});

test('snsRegion property is recognized', () => {
// GIVEN
const stack = new Stack();
const role = Role.fromRoleArn(stack, 'smsRole', 'arn:aws:iam::664773442901:role/sms-role');

// WHEN
new UserPool(stack, 'Pool', {
smsRole: role,
smsRoleExternalId: 'test-external-id',
snsRegion: 'test-region-1',
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Cognito::UserPool', {
SmsConfiguration: {
ExternalId: 'test-external-id',
SnsCallerArn: role.roleArn,
SnsRegion: 'test-region-1',
},
});
});

test('import using id', () => {
// GIVEN
const stack = new Stack(undefined, undefined, {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-docdb/lib/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ abstract class DatabaseInstanceBase extends cdk.Resource implements IDatabaseIns
*/
public get instanceArn(): string {
return cdk.Stack.of(this).formatArn({
service: 'docdb',
service: 'rds',
resource: 'db',
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
resourceName: this.instanceIdentifier,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-docdb/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('DatabaseInstance', () => {
[
'arn:',
{ Ref: 'AWS::Partition' },
':docdb:us-test-1:12345:db:',
':rds:us-test-1:12345:db:',
{ Ref: 'InstanceC1063A87' },
],
],
Expand Down Expand Up @@ -160,7 +160,7 @@ describe('DatabaseInstance', () => {
[
'arn:',
{ Ref: 'AWS::Partition' },
`:docdb:us-test-1:12345:db:${instanceIdentifier}`,
`:rds:us-test-1:12345:db:${instanceIdentifier}`,
],
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"aws-sdk-mock": "5.6.0",
"jest": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.3"
"ts-jest": "^27.1.4"
},
"dependencies": {
"@aws-cdk/aws-applicationautoscaling": "0.0.0",
Expand Down
23 changes: 20 additions & 3 deletions packages/@aws-cdk/aws-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,16 @@ MachineImage.genericLinux({ ... })` and configure the right AMI ID for the
regions you want to deploy to.

By default, the NAT instances will route all traffic. To control what traffic
gets routed, pass `allowAllTraffic: false` and access the
`NatInstanceProvider.connections` member after having passed it to the VPC:
gets routed, pass a custom value for `defaultAllowedTraffic` and access the
`NatInstanceProvider.connections` member after having passed the NAT provider to
the VPC:

```ts
declare const instanceType: ec2.InstanceType;

const provider = ec2.NatProvider.instance({
instanceType,
allowAllTraffic: false,
defaultAllowedTraffic: ec2.NatTrafficDirection.OUTBOUND_ONLY,
});
new ec2.Vpc(this, 'TheVPC', {
natGatewayProvider: provider,
Expand Down Expand Up @@ -1475,3 +1476,19 @@ const template = new ec2.LaunchTemplate(this, 'LaunchTemplate', {
}),
});
```

## Detailed Monitoring

The following demonstrates how to enable [Detailed Monitoring](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html) for an EC2 instance. Keep in mind that Detailed Monitoring results in [additional charges](http://aws.amazon.com/cloudwatch/pricing/).

```ts
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;

new ec2.Instance(this, 'Instance1', {
vpc,
instanceType,
machineImage: new ec2.AmazonLinuxImage(),
detailedMonitoring: true,
});
```
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-ec2/lib/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ export interface InstanceProps {
* @default - false
*/
readonly requireImdsv2?: boolean;

/**
* Whether "Detailed Monitoring" is enabled for this instance
* Keep in mind that Detailed Monitoring results in extra charges
*
* @see http://aws.amazon.com/cloudwatch/pricing/
* @default - false
*/
readonly detailedMonitoring?: boolean;
}

/**
Expand Down Expand Up @@ -381,6 +390,7 @@ export class Instance extends Resource implements IInstance {
blockDeviceMappings: props.blockDevices !== undefined ? instanceBlockDeviceMappings(this, props.blockDevices) : undefined,
privateIpAddress: props.privateIpAddress,
propagateTagsToVolumeOnCreation: props.propagateTagsToVolumeOnCreation,
monitoring: props.detailedMonitoring,
});
this.instance.node.addDependency(this.role);

Expand Down
Loading

0 comments on commit 0fc25bd

Please sign in to comment.