Skip to content

Commit

Permalink
Merge branch 'master' into iot-actions-republish
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Jan 31, 2022
2 parents 4868f69 + 203cd9a commit 0a8ad71
Show file tree
Hide file tree
Showing 226 changed files with 2,657 additions and 741 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [opened, edited]

jobs:
triage-manager:
issue-triage-manager:
permissions:
issues: write
pull-requests: write
Expand All @@ -17,14 +17,50 @@ jobs:
- uses: aws-github-ops/aws-issue-triage-manager@main
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
target: "issues"
excluded-expressions: "[CDK CLI Version|TypeScript|Java|Python]"
area-is-keyword: true
excluded-labels: "[p1|p2|p0|contribution/core]"
default-area: >
included-labels: "[needs-triage]"
excluded-labels: "[p1|p2|p0|effort-small|effort-medium|effort-large|guidance]"
default-area: ${{ env.OSDS_DEVS }}
parameters: ${{ env.AREA_PARAMS }}
guidance-triage-manager:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: aws-github-ops/aws-issue-triage-manager@main
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
target: "issues"
excluded-expressions: "[CDK CLI Version|TypeScript|Java|Python]"
area-is-keyword: true
included-labels: "[guidance]"
default-area: ${{ env.OSDS_DEVS }}
parameters: >
[{"area":"guidance","keywords":["guidance"]}]
pr-triage-manager:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: aws-github-ops/aws-issue-triage-manager@main
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
target: "pull-requests"
area-is-keyword: true
excluded-labels: "[contribution/core]"
parameters: ${{ env.AREA_PARAMS }}

env:
OSDS_DEVS: >
{
"assignees":["NGL321","peterwoodworth","ryparker"]
}
parameters: >
AREA_PARAMS: >
[
{"area":"package/tools","keywords":["cli","command line","init","synth","diff","bootstrap"],"labels":["package/tools"],"assignees":["rix0rrr"]},
{"area":"@aws-cdk/alexa-ask","keywords":["alexa-ask","alexa", "cfnskill"],"labels":["@aws-cdk/alexa-ask"],"assignees":["madeline-k"]},
Expand Down
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,63 @@

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.142.0](https://github.com/aws/aws-cdk/compare/v1.141.0...v1.142.0) (2022-01-28)


### Features

* **cfnspec:** cloudformation spec v53.1.0 ([#18680](https://github.com/aws/aws-cdk/issues/18680)) ([f385059](https://github.com/aws/aws-cdk/commit/f38505911a3e140a9cb6b269bdf22abe9803c515))
* **cloudfront-origins:** extend `readTimeout` maximum value for `HttpOriginProps` ([#18697](https://github.com/aws/aws-cdk/issues/18697)) ([e64de67](https://github.com/aws/aws-cdk/commit/e64de677cdfc014f68e92b204f4728e60a8bb111)), closes [#18628](https://github.com/aws/aws-cdk/issues/18628)
* **eks:** cluster logging ([#18112](https://github.com/aws/aws-cdk/issues/18112)) ([872277b](https://github.com/aws/aws-cdk/commit/872277b9e853dbf5f2cac84b5afb6d26e0ed5659)), closes [#4159](https://github.com/aws/aws-cdk/issues/4159)
* **iotevents:** allow setting description, evaluation method and key of DetectorModel ([#18644](https://github.com/aws/aws-cdk/issues/18644)) ([2eeaebc](https://github.com/aws/aws-cdk/commit/2eeaebc3cdc9c5c7ef3fa312b3d1abca265dcbb6))
* **lambda-python:** support setting environment vars for bundling ([#18635](https://github.com/aws/aws-cdk/issues/18635)) ([30e2233](https://github.com/aws/aws-cdk/commit/30e223333fef0b0d7f12287dab170a34e092d7fa))


### Bug Fixes

* **aws-lambda-nodejs:** pre compilation with tsc is not being run ([#18062](https://github.com/aws/aws-cdk/issues/18062)) ([7ac7221](https://github.com/aws/aws-cdk/commit/7ac7221aff3c612ab80e7812c371b11c56e5db0a)), closes [#18002](https://github.com/aws/aws-cdk/issues/18002)
* **pipelines:** undeployable due to dependency cycle ([#18686](https://github.com/aws/aws-cdk/issues/18686)) ([009d689](https://github.com/aws/aws-cdk/commit/009d68912267de9dcf4136a7d80a652a891b7bb9)), closes [#18492](https://github.com/aws/aws-cdk/issues/18492) [#18673](https://github.com/aws/aws-cdk/issues/18673)

## [1.141.0](https://github.com/aws/aws-cdk/compare/v1.140.0...v1.141.0) (2022-01-27)


### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

* **servicecatalog:** `TagOptions` now have `scope` and `props` argument in constructor, and data is now passed via a `allowedValueForTags` field in props

### Features

* **assertions:** support assertions on stack messages ([#18521](https://github.com/aws/aws-cdk/issues/18521)) ([cb86e30](https://github.com/aws/aws-cdk/commit/cb86e30391aefdda13e6b0d4b3be2fedf76477c8)), closes [#18347](https://github.com/aws/aws-cdk/issues/18347)
* **assertions:** support for conditions ([#18577](https://github.com/aws/aws-cdk/issues/18577)) ([55ff1b2](https://github.com/aws/aws-cdk/commit/55ff1b2e69f1b42bbbecd9dc95e17f2ffc35f94e)), closes [#18560](https://github.com/aws/aws-cdk/issues/18560)
* **aws-ecs-patterns:** adding support for custom HealthCheck while creating QueueProcessingFargateService ([#18219](https://github.com/aws/aws-cdk/issues/18219)) ([0ca81a1](https://github.com/aws/aws-cdk/commit/0ca81a118d3d54b87d2d05a53fb72e4efe03b591)), closes [#15636](https://github.com/aws/aws-cdk/issues/15636)
* **certificatemanager:** DnsValidatedCertificate DNS record cleanup ([#18311](https://github.com/aws/aws-cdk/issues/18311)) ([36d356d](https://github.com/aws/aws-cdk/commit/36d356d0b3e422f7451f4b0dd2f971aa0378210e)), closes [#3333](https://github.com/aws/aws-cdk/issues/3333) [#7063](https://github.com/aws/aws-cdk/issues/7063)
* **cfnspec:** cloudformation spec v53.1.0 ([#18588](https://github.com/aws/aws-cdk/issues/18588)) ([a283a48](https://github.com/aws/aws-cdk/commit/a283a482dead64e94383ba21cc7908f10c4459a2))
* **cfnspec:** cloudformation spec v53.1.0 ([#18658](https://github.com/aws/aws-cdk/issues/18658)) ([2eda19e](https://github.com/aws/aws-cdk/commit/2eda19e510374426190531810cff518d582644ad))
* **ec2:** session timeout and login banner for client vpn endpoint ([#18590](https://github.com/aws/aws-cdk/issues/18590)) ([7294118](https://github.com/aws/aws-cdk/commit/72941180a7188e5560a58f1509554ef038544ec4))
* **ecs:** add `BaseService.fromServiceArnWithCluster()` for use in CodePipeline ([#18530](https://github.com/aws/aws-cdk/issues/18530)) ([3d192a9](https://github.com/aws/aws-cdk/commit/3d192a9a832857cb246d719a68b4b8f40d807fed))
* **iotevents:** add DetectorModel L2 Construct ([#18049](https://github.com/aws/aws-cdk/issues/18049)) ([d0960f1](https://github.com/aws/aws-cdk/commit/d0960f181e5f66daa1eb53be2190b7e62bd66030)), closes [#17711](https://github.com/aws/aws-cdk/issues/17711) [#17711](https://github.com/aws/aws-cdk/issues/17711)
* **lambda-nodejs:** Allow setting mainFields for esbuild ([#18569](https://github.com/aws/aws-cdk/issues/18569)) ([0e78aeb](https://github.com/aws/aws-cdk/commit/0e78aeb9ad62226e67f72f23c0008ba749b3a73b))
* **s3:** custom role for the bucket notifications handler ([#17794](https://github.com/aws/aws-cdk/issues/17794)) ([43f232d](https://github.com/aws/aws-cdk/commit/43f232ddc0a18e9a2fada2fbead758ab3538adc2)), closes [#9918](https://github.com/aws/aws-cdk/issues/9918) [#13241](https://github.com/aws/aws-cdk/issues/13241)
* **servicecatalog:** Create TagOptions Construct ([#18314](https://github.com/aws/aws-cdk/issues/18314)) ([903c4b6](https://github.com/aws/aws-cdk/commit/903c4b6e4adf676fae42265a048dddd0e1386542)), closes [#17753](https://github.com/aws/aws-cdk/issues/17753)


### Bug Fixes

* **apigatewayv2:** websocket api: allow all methods in grant manage connections ([#18544](https://github.com/aws/aws-cdk/issues/18544)) ([41c8a3f](https://github.com/aws/aws-cdk/commit/41c8a3fa6b50a94affb65286d862056050d02e84)), closes [#18410](https://github.com/aws/aws-cdk/issues/18410)
* **aws-apigateway:** cross region authorizer ref ([#18444](https://github.com/aws/aws-cdk/issues/18444)) ([0e0a092](https://github.com/aws/aws-cdk/commit/0e0a0922ba1d538abdfeb61a260c262109115038))
* **cli:** hotswap should wait for lambda's `updateFunctionCode` to complete ([#18536](https://github.com/aws/aws-cdk/issues/18536)) ([0e08eeb](https://github.com/aws/aws-cdk/commit/0e08eebd2f13ab0da6cac7b91288845cad530192)), closes [#18386](https://github.com/aws/aws-cdk/issues/18386) [#18386](https://github.com/aws/aws-cdk/issues/18386)
* **ecs:** only works in 'aws' partition ([#18496](https://github.com/aws/aws-cdk/issues/18496)) ([525ac07](https://github.com/aws/aws-cdk/commit/525ac07369e33e2f36b7a0eea7913e43649484db)), closes [#18429](https://github.com/aws/aws-cdk/issues/18429)
* **ecs-patterns:** Fix Network Load Balancer Port assignments in ECS Patterns ([#18157](https://github.com/aws/aws-cdk/issues/18157)) ([1393729](https://github.com/aws/aws-cdk/commit/13937299596d0b858d56e9116bf7a7dbe039d4b4)), closes [#18073](https://github.com/aws/aws-cdk/issues/18073)
* **elasticloadbalancingv2:** ApplicationLoadBalancer.logAccessLogs does not grant all necessary permissions ([#18558](https://github.com/aws/aws-cdk/issues/18558)) ([bde1795](https://github.com/aws/aws-cdk/commit/bde17950293309b7449fc412301634770b47111f)), closes [#18367](https://github.com/aws/aws-cdk/issues/18367)
* **pipelines:** CodeBuild projects are hard to tell apart ([#18492](https://github.com/aws/aws-cdk/issues/18492)) ([f6dab8d](https://github.com/aws/aws-cdk/commit/f6dab8d8c5aa4cf56d6846e2d13c1d5641136f72))
* **region-info:** incorrect codedeploy service principals ([#18505](https://github.com/aws/aws-cdk/issues/18505)) ([16db963](https://github.com/aws/aws-cdk/commit/16db9639e86f1fd6f26a1054f4d6df24801d0f05))
* **route53:** add RoutingControlArn to HealthCheck patch ([#18645](https://github.com/aws/aws-cdk/issues/18645)) ([c58e8bb](https://github.com/aws/aws-cdk/commit/c58e8bbbcb0a66c37b65cddc1da8d19dfbf26b4f)), closes [#18570](https://github.com/aws/aws-cdk/issues/18570)
* **s3:** add missing safe actions to `grantWrite`, `grantReadWrite` and `grantPut` methods ([#18494](https://github.com/aws/aws-cdk/issues/18494)) ([940d043](https://github.com/aws/aws-cdk/commit/940d0439cd347f06d755f3e3dd0582470749f710)), closes [#13616](https://github.com/aws/aws-cdk/issues/13616)
* **secretsmanager:** SecretRotation for secret imported by name has incorrect permissions ([#18567](https://github.com/aws/aws-cdk/issues/18567)) ([9ed263c](https://github.com/aws/aws-cdk/commit/9ed263cde0b41959ff267720c0978bfe7449337a)), closes [#18424](https://github.com/aws/aws-cdk/issues/18424)
* **stepfunctions:** task token integration cannot be used with API Gateway ([#18595](https://github.com/aws/aws-cdk/issues/18595)) ([678eede](https://github.com/aws/aws-cdk/commit/678eeded5d5631dbacff43ead697ecbd3bd4b27d)), closes [#14184](https://github.com/aws/aws-cdk/issues/14184) [#14181](https://github.com/aws/aws-cdk/issues/14181)
* **stepfunctions-tasks:** cluster creation fails with unresolved release labels ([#18288](https://github.com/aws/aws-cdk/issues/18288)) ([9940952](https://github.com/aws/aws-cdk/commit/9940952d67bdf07f3d737dc88676dc7f7c435a12))
* **synthetics:** correct getbucketlocation policy ([#13573](https://github.com/aws/aws-cdk/issues/13573)) ([e743525](https://github.com/aws/aws-cdk/commit/e743525b6379371110d737bb360f637c41d30ca1)), closes [#13572](https://github.com/aws/aws-cdk/issues/13572)

## [1.140.0](https://github.com/aws/aws-cdk/compare/v1.139.0...v1.140.0) (2022-01-20)


Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
},
"resolutions": {
"colors": "1.4.0",
"string-width": "^4.2.3"
"string-width": "^4.2.3",
"markdown-it": "^12.3.2"
},
"repository": {
"type": "git",
Expand Down
9 changes: 8 additions & 1 deletion packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
]
}
},
"projectReferences": true
"projectReferences": true,
"metadata": {
"jsii": {
"rosetta": {
"strict": true
}
}
}
},
"repository": {
"type": "git",
Expand Down
17 changes: 12 additions & 5 deletions packages/@aws-cdk/app-delivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ import * as codepipeline from '@aws-cdk/aws-codepipeline';
import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions';
import * as cdk from '@aws-cdk/core';
import * as cicd from '@aws-cdk/app-delivery';
import * as iam from '@aws-cdk/aws-iam';

class MyServiceStackA extends cdk.Stack {}
class MyServiceStackB extends cdk.Stack {}

const app = new cdk.App();

Expand All @@ -77,7 +81,9 @@ const sourceOutput = new codepipeline.Artifact();
const source = new codepipeline_actions.GitHubSourceAction({
actionName: 'GitHub',
output: sourceOutput,
/* ... */
owner: 'myName',
repo: 'myRepo',
oauthToken: cdk.SecretValue.plainText('secret'),
});
pipeline.addStage({
stageName: 'source',
Expand Down Expand Up @@ -129,10 +135,11 @@ deployStage.addAction(deployServiceAAction);
// is passed to CloudFormation and needs the permissions necessary to deploy
// stack. Alternatively you can enable [Administrator](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator) permissions above,
// users should understand the privileged nature of this role.
deployServiceAAction.addToRolePolicy(new iam.PolicyStatement({
actions: ['service:SomeAction'],
resources: [myResource.myResourceArn],
// add more Action(s) and/or Resource(s) here, as needed
const myResourceArn = 'arn:partition:service:region:account-id:resource-id';
deployServiceAAction.addToDeploymentRolePolicy(new iam.PolicyStatement({
actions: ['service:SomeAction'],
resources: [myResourceArn],
// add more Action(s) and/or Resource(s) here, as needed
}));

const serviceStackB = new MyServiceStackB(app, 'ServiceStackB', { /* ... */ });
Expand Down
9 changes: 8 additions & 1 deletion packages/@aws-cdk/app-delivery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
}
},
"outdir": "dist",
"projectReferences": true
"projectReferences": true,
"metadata": {
"jsii": {
"rosetta": {
"strict": true
}
}
}
},
"scripts": {
"build": "cdk-build",
Expand Down
123 changes: 123 additions & 0 deletions packages/@aws-cdk/assertions/MIGRATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Migrating to Assertions

Most of the APIs in the old `assert` module has a corresponding API in `assertions`.
Make the following modifications to your CDK test files to migrate to the
`@aws-cdk/assertions` module.

For a migration script that handles most common use cases for you, see
[Migration Script](migration-script).

## Translation Guide

- Rewrite module imports that use `@aws-cdk/aws-assert` to `@aws-cdk/aws-assertions`.
For example:

```ts
import '@aws-cdk/assert/jest';
import { ABSENT, SynthUtils, ResourcePart } from '@aws-cdk/assert';
```

...becomes...

```ts
import { Template } from '@aws-cdk/assertions';
import { Match, Template } from '@aws-cdk/assertions';
```

- Replace instances of `toHaveResource()` with `hasResourceProperties()` or `hasResource()`.
For example:

```ts
expect(stack).toHaveResource('FOO::BAR', {/*...*/});
expect(stack).toHaveResource('FOO::BAR', {/*...*/}, ResourcePart.CompleteDefinition);
```

...becomes...

```ts
Template.fromStack(stack).hasResourceProperties('FOO::BAR', {/*...*/});
Template.fromStack(stacK).hasResource('FOO::BAR', {/*...*/});
```

- Replace instances of `toCountResources()` with `resourceCountIs`. For example:

```ts
expect(stack).toCountResources('FOO::BAR', 1);
```

...becomes...

```ts
Template.fromStack(stack).resourceCountIs('FOO::BAR', 1);
```
- Replace instances of `toMatchTemplate()` with `templateMatches()`. For example:

```ts
expect(stack).toMatchTemplate({/*...*/});
```

...becomes...

```ts
Template.fromStack(stack).templateMatches({/*...*/});
```

- Replace `arrayWith()` with `Match.arrayWith()`, `objectLike()` with `Match.objectLike()`, and
`ABSENT` with `Match.absent()`.

- `not` can be replaced with `Match.not()` _or_ `resourceCountIs()` depending on the use case.

```ts
// asserting that the stack does not have a particular resource.
expect(stack).not.toHaveResource('FOO::BAR');
```

...becomes...

```ts
Template.fromStack(stack).resourceCountIs('FOO::BAR', 0);
```

```ts
// asserting that the stack does not have a resource with these properties
expect(stack).not.toHaveResource('FOO::BAR', {
prop: 'does not exist',
});
```

...becomes...

```ts
Template.fromStack(stack).hasResourceProperties('FOO::BAR', Match.not({
prop: 'does not exist',
}));
```

- `SynthUtils.synthesize(stack)` can be replaced as well. For example:

```ts
expect(SynthUtils.synthesize(stack).template).toEqual(/*...*/);
SynthUtils.syntesize(stack);
```

...becomes...

```ts
expect(Template.fromStack(stack).toJSON()).toEqual(/*...*/);
App.of(stack).synth();
```

## Migration Script

> NOTE: We have some code rewrite rules that will make it easier to migrate from one library
> to the other. This tool will not do a complete rewrite and is not guaranteed to produce
> compilable code! It will just save you the effort of performing a lot of code substitutions
> you would otherwise have to do by hand.

Comby is a tool used to do structured code rewriting. You can install it
[here](https://comby.dev/). Download the [rewrite.toml](rewrite.toml) file from our GitHub
repository, and run the following command in the root directory of your project:

```bash
comby -config ~/rewrite.toml -f .ts -d test -in-place -timeout 10
```
3 changes: 3 additions & 0 deletions packages/@aws-cdk/assertions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

<!--END STABILITY BANNER-->

If you're migrating from the old `assert` library, the migration guide can be found in
[our GitHub repository](https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/assertions/MIGRATING.md).

Functions for writing test asserting against CDK applications, with focus on CloudFormation templates.

The `Template` class includes a set of methods for writing assertions against CloudFormation templates. Use one of the `Template.fromXxx()` static methods to create an instance of this class.
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assertions/lib/private/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { filterLogicalId, formatFailure, matchSection } from './section';
import { Template } from './template';

export function findConditions(template: Template, logicalId: string, props: any = {}): { [key: string]: { [key: string]: any } } {
const section: { [key: string] : {} } = template.Conditions;
const section: { [key: string] : {} } = template.Conditions ?? {};
const result = matchSection(filterLogicalId(section, logicalId), props);

if (!result.match) {
Expand All @@ -13,7 +13,7 @@ export function findConditions(template: Template, logicalId: string, props: any
}

export function hasCondition(template: Template, logicalId: string, props: any): string | void {
const section: { [key: string] : {} } = template.Conditions;
const section: { [key: string] : {} } = template.Conditions ?? {};
const result = matchSection(filterLogicalId(section, logicalId), props);
if (result.match) {
return;
Expand Down
Loading

0 comments on commit 0a8ad71

Please sign in to comment.