Skip to content

Commit 4966d40

Browse files
committed
Merge remote-tracking branch 'origin/master' into cfn-init
2 parents 3bb9ba4 + cec382c commit 4966d40

File tree

106 files changed

+2657
-2875
lines changed

Some content is hidden

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

106 files changed

+2657
-2875
lines changed

.github/workflows/issue-label-assign.yml

+87-86
Large diffs are not rendered by default.

CONTRIBUTING.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ $ yarn install
9393
$ yarn build
9494
```
9595

96-
If you get compiler errors when building, a common cause is globally installed tools like tslint and typescript. Try uninstalling them.
96+
If you get compiler errors when building, a common cause is a globally installed typescript. Try uninstalling it.
9797

9898
```
99-
npm uninstall -g tslint
10099
npm uninstall -g typescript
101100
```
102101

@@ -277,7 +276,7 @@ However, in many cases, you can probably get away with just building a portion o
277276
want to work on.
278277

279278
We recommend that you use [Visual Studio Code](https://code.visualstudio.com/) to work on the CDK. Be sure to install
280-
the [tslint extension](https://marketplace.visualstudio.com/items?itemName=eg2.tslint) for it as well, since we have
279+
the [eslint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) for it as well, since we have
281280
strict linting rules that will prevent your code from compiling, but with VSCode and this extension can be automatically
282281
fixed for you by hitting `Ctrl-.` when your cursor is on a red underline.
283282

@@ -332,9 +331,6 @@ The following linters are used -
332331

333332
#### eslint
334333

335-
Historically, the CDK has used tslint for linting its typescript source code. With [tslint's deprecation in
336-
2019](https://medium.com/palantir/tslint-in-2019-1a144c2317a9), we are slowly moving over to using eslint.
337-
338334
All packages in the repo use a standard base configuration found at [eslintrc.js](tools/cdk-build-tools/config/eslintrc.js).
339335
This can be customized for any package by modifying the `.eslintrc` file found at its root.
340336

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
"jsii-diff": "^1.8.0",
2121
"jsii-pacmak": "^1.8.0",
2222
"jsii-rosetta": "^1.8.0",
23+
"jest-junit": "^11.0.1",
2324
"lerna": "^3.22.1",
24-
"standard-version": "^8.0.0",
25+
"standard-version": "^8.0.2",
2526
"typescript": "~3.9.6"
2627
},
2728
"resolutions-comment": "should be removed or reviewed when nodeunit dependency is dropped or adjusted",

packages/@aws-cdk/assert/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
},
2222
"license": "Apache-2.0",
2323
"devDependencies": {
24-
"@types/jest": "^26.0.3",
24+
"@types/jest": "^26.0.4",
2525
"cdk-build-tools": "0.0.0",
2626
"jest": "^25.5.4",
2727
"pkglint": "0.0.0",
28-
"ts-jest": "^26.1.1"
28+
"ts-jest": "^26.1.2"
2929
},
3030
"dependencies": {
3131
"@aws-cdk/cloudformation-diff": "0.0.0",

packages/@aws-cdk/aws-ce/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*.js.map
33
*.d.ts
44
tsconfig.json
5-
tslint.json
65
node_modules
76
*.generated.ts
87
dist
@@ -18,4 +17,4 @@ nyc.config.js
1817
!.eslintrc.js
1918
!jest.config.js
2019

21-
junit.xml
20+
junit.xml

packages/@aws-cdk/aws-certificatemanager/suffixes/build-map.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131

3232
with open('../lib/public-suffixes.ts', 'w') as o:
3333
o.write('// This file has been generated using ../suffixes/build-map.py\n')
34-
o.write('// tslint:disable:no-trailing-whitespace object-literal-key-quotes\n')
34+
o.write('/* eslint-disable no-trailing-spaces, quote-props */\n')
3535
o.write('export const publicSuffixes = %s;' % json.dumps(trie, indent=2))

packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export interface BitBucketSourceActionProps extends codepipeline.CommonAwsAction
5959
* @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html#action-reference-CodestarConnectionSource-config
6060
*/
6161
readonly codeBuildCloneOutput?: boolean;
62-
// tslint:enable:max-line-length
6362
}
6463

6564
/**

packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts

-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ interface CloudFormationDeployActionProps extends CloudFormationActionProps {
234234
*/
235235
readonly extraInputs?: codepipeline.Artifact[];
236236
}
237-
// tslint:enable:max-line-length
238237

239238
/**
240239
* Base class for all CloudFormation actions that execute or stage deployments.

packages/@aws-cdk/aws-codepipeline-actions/lib/custom-action-registration.ts

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export interface CustomActionProperty {
3636
*/
3737
queryable?: boolean;
3838

39-
// tslint:enable:max-line-length
40-
4139
/**
4240
* Whether this property is required.
4341
*/

packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ export interface LambdaInvokeActionProps extends codepipeline.CommonAwsActionPro
3838
*/
3939
readonly userParameters?: { [key: string]: any };
4040

41-
// tslint:enable:max-line-length
42-
4341
/**
4442
* The lambda function to invoke.
4543
*/

packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts

-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ export interface CustomAttributeConfig {
153153
* @see https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SchemaAttributeType.html#CognitoUserPools-Type-SchemaAttributeType-AttributeDataType
154154
*/
155155
readonly dataType: string;
156-
// tslint:enable:max-line-length
157156

158157
/**
159158
* The constraints for a custom attribute of 'String' data type.

packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts

-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ export class OAuthScope {
136136
* The name of this scope as recognized by CloudFormation.
137137
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-allowedoauthscopes
138138
*/
139-
// tslint:enable:max-line-length
140139
public readonly scopeName: string;
141140

142141
private constructor(scopeName: string) {

packages/@aws-cdk/aws-detective/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*.js.map
33
*.d.ts
44
tsconfig.json
5-
tslint.json
65
node_modules
76
*.generated.ts
87
dist
@@ -18,4 +17,4 @@ nyc.config.js
1817
!.eslintrc.js
1918
!jest.config.js
2019

21-
junit.xml
20+
junit.xml

packages/@aws-cdk/aws-docdb/lib/instance.ts

-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export interface DatabaseInstanceProps {
155155
* time for each AWS Region, occurring on a random day of the week. To see
156156
* the time blocks available, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-maintain.html#maintenance-window
157157
*/
158-
// tslint:enable:max-line-length
159158
readonly preferredMaintenanceWindow?: string;
160159

161160
/**

packages/@aws-cdk/aws-dynamodb/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"license": "Apache-2.0",
6565
"devDependencies": {
6666
"@aws-cdk/assert": "0.0.0",
67-
"@types/jest": "^26.0.3",
67+
"@types/jest": "^26.0.4",
6868
"aws-sdk": "^2.713.0",
6969
"aws-sdk-mock": "^5.1.0",
7070
"cdk-build-tools": "0.0.0",
@@ -73,7 +73,7 @@
7373
"jest": "^25.5.4",
7474
"pkglint": "0.0.0",
7575
"sinon": "^9.0.2",
76-
"ts-jest": "^26.1.1"
76+
"ts-jest": "^26.1.2"
7777
},
7878
"dependencies": {
7979
"@aws-cdk/aws-applicationautoscaling": "0.0.0",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const repository = new ecr.Repository(this, 'Repository');
2222

2323
### Image scanning
2424

25-
Amazon ECR image scanning helps in identifying software vulnerabilities in your container images. You can manually scan container images stored in Amazon ECR, or you can configure your repositories to scan images when you push them to a repository. To create a new reposity to scan on push, simply enable `imageScanOnPush` in the properties
25+
Amazon ECR image scanning helps in identifying software vulnerabilities in your container images. You can manually scan container images stored in Amazon ECR, or you can configure your repositories to scan images when you push them to a repository. To create a new repository to scan on push, simply enable `imageScanOnPush` in the properties
2626

2727
```ts
2828
const repository = new ecr.Repository(stack, 'Repo', {

packages/@aws-cdk/aws-eks/lib/cluster.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
13
import * as autoscaling from '@aws-cdk/aws-autoscaling';
24
import * as ec2 from '@aws-cdk/aws-ec2';
35
import * as iam from '@aws-cdk/aws-iam';
46
import * as ssm from '@aws-cdk/aws-ssm';
57
import { CfnOutput, CfnResource, Construct, IResource, Resource, Stack, Tag, Token } from '@aws-cdk/core';
6-
import * as fs from 'fs';
7-
import * as path from 'path';
88
import * as YAML from 'yaml';
99
import { AwsAuth } from './aws-auth';
1010
import { clusterArnComponents, ClusterResource } from './cluster-resource';
@@ -492,6 +492,16 @@ export class Cluster extends Resource implements ICluster {
492492
resource = new ClusterResource(this, 'Resource', clusterProps);
493493
this._clusterResource = resource;
494494

495+
// see https://github.com/aws/aws-cdk/issues/9027
496+
this._clusterResource.creationRole.addToPolicy(new iam.PolicyStatement({
497+
actions: ['ec2:DescribeVpcs'],
498+
resources: [ stack.formatArn({
499+
service: 'ec2',
500+
resource: 'vpc',
501+
resourceName: this.vpc.vpcId,
502+
})],
503+
}));
504+
495505
// we use an SSM parameter as a barrier because it's free and fast.
496506
this._kubectlReadyBarrier = new CfnResource(this, 'KubectlReadyBarrier', {
497507
type: 'AWS::SSM::Parameter',

packages/@aws-cdk/aws-eks/test/integ.eks-cluster.expected.json

+19
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,25 @@
768768
"Effect": "Allow",
769769
"Resource": "*"
770770
},
771+
{
772+
"Action": "ec2:DescribeVpcs",
773+
"Effect": "Allow",
774+
"Resource": {
775+
"Fn::Join": [
776+
"",
777+
[
778+
"arn:",
779+
{
780+
"Ref": "AWS::Partition"
781+
},
782+
":ec2:test-region:12345678:vpc/",
783+
{
784+
"Ref": "Vpc8378EB38"
785+
}
786+
]
787+
]
788+
}
789+
},
771790
{
772791
"Action": "iam:PassRole",
773792
"Effect": "Allow",

packages/@aws-cdk/aws-eks/test/test.cluster.ts

+47-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as fs from 'fs';
2+
import * as path from 'path';
23
import { countResources, expect, haveResource, haveResourceLike, not } from '@aws-cdk/assert';
34
import * as ec2 from '@aws-cdk/aws-ec2';
45
import * as iam from '@aws-cdk/aws-iam';
56
import * as cdk from '@aws-cdk/core';
67
import { Test } from 'nodeunit';
7-
import * as path from 'path';
88
import * as YAML from 'yaml';
99
import * as eks from '../lib';
1010
import { KubectlLayer } from '../lib/kubectl-layer';
@@ -1040,6 +1040,29 @@ export = {
10401040
Effect: 'Allow',
10411041
Resource: '*',
10421042
},
1043+
{
1044+
Action: 'ec2:DescribeVpcs',
1045+
Effect: 'Allow',
1046+
Resource: {
1047+
'Fn::Join': [
1048+
'',
1049+
[
1050+
'arn:',
1051+
{
1052+
Ref: 'AWS::Partition',
1053+
},
1054+
':ec2:us-east-1:',
1055+
{
1056+
Ref: 'AWS::AccountId',
1057+
},
1058+
':vpc/',
1059+
{
1060+
Ref: 'MyClusterDefaultVpc76C24A38',
1061+
},
1062+
],
1063+
],
1064+
},
1065+
},
10431066
],
10441067
Version: '2012-10-17',
10451068
},
@@ -1109,6 +1132,29 @@ export = {
11091132
Effect: 'Allow',
11101133
Resource: '*',
11111134
},
1135+
{
1136+
Action: 'ec2:DescribeVpcs',
1137+
Effect: 'Allow',
1138+
Resource: {
1139+
'Fn::Join': [
1140+
'',
1141+
[
1142+
'arn:',
1143+
{
1144+
Ref: 'AWS::Partition',
1145+
},
1146+
':ec2:us-east-1:',
1147+
{
1148+
Ref: 'AWS::AccountId',
1149+
},
1150+
':vpc/',
1151+
{
1152+
Ref: 'MyClusterDefaultVpc76C24A38',
1153+
},
1154+
],
1155+
],
1156+
},
1157+
},
11121158
],
11131159
Version: '2012-10-17',
11141160
},

packages/@aws-cdk/aws-eks/test/test.fargate.ts

+27
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,33 @@ export = {
405405
Effect: 'Allow',
406406
Resource: '*',
407407
},
408+
{
409+
Action: 'ec2:DescribeVpcs',
410+
Effect: 'Allow',
411+
Resource: {
412+
'Fn::Join': [
413+
'',
414+
[
415+
'arn:',
416+
{
417+
Ref: 'AWS::Partition',
418+
},
419+
':ec2:',
420+
{
421+
Ref: 'AWS::Region',
422+
},
423+
':',
424+
{
425+
Ref: 'AWS::AccountId',
426+
},
427+
':vpc/',
428+
{
429+
Ref: 'FargateClusterDefaultVpcE69D3A13',
430+
},
431+
],
432+
],
433+
},
434+
},
408435
{
409436
Action: 'iam:PassRole',
410437
Effect: 'Allow',

packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts

+2-30
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as ec2 from '@aws-cdk/aws-ec2';
22
import * as iam from '@aws-cdk/aws-iam';
33
import * as s3 from '@aws-cdk/aws-s3';
44
import { Construct, IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core';
5+
import { RegionInfo } from '@aws-cdk/region-info';
56
import { CfnLoadBalancer } from '../elasticloadbalancingv2.generated';
67
import { Attributes, ifUndefined, renderAttributes } from './util';
78

@@ -170,7 +171,7 @@ export abstract class BaseLoadBalancer extends Resource {
170171
throw new Error('Region is required to enable ELBv2 access logging');
171172
}
172173

173-
const account = ELBV2_ACCOUNTS[region];
174+
const account = RegionInfo.get(region).elbv2Account;
174175
if (!account) {
175176
throw new Error(`Cannot enable access logging; don't know ELBv2 account for region ${region}`);
176177
}
@@ -198,32 +199,3 @@ export abstract class BaseLoadBalancer extends Resource {
198199
this.setAttribute(key, undefined);
199200
}
200201
}
201-
202-
// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-logging-bucket-permissions
203-
const ELBV2_ACCOUNTS: { [region: string]: string } = {
204-
'us-east-1': '127311923021',
205-
'us-east-2': '033677994240',
206-
'us-west-1': '027434742980',
207-
'us-west-2': '797873946194',
208-
'af-south-1': '098369216593',
209-
'ca-central-1': '985666609251',
210-
'eu-central-1': '054676820928',
211-
'eu-west-1': '156460612806',
212-
'eu-west-2': '652711504416',
213-
'eu-west-3': '009996457667',
214-
'eu-south-1': '635631232127',
215-
'eu-north-1': '897822967062',
216-
'ap-east-1': '754344448648',
217-
'ap-northeast-1': '582318560864',
218-
'ap-northeast-2': '600734575887',
219-
'ap-northeast-3': '383597477331',
220-
'ap-southeast-1': '114774131450',
221-
'ap-southeast-2': '783225319266',
222-
'ap-south-1': '718504428378',
223-
'me-south-1': '076674570225',
224-
'sa-east-1': '507241528517',
225-
'us-gov-west-1': '048591011584',
226-
'us-gov-east-1': '190560391635',
227-
'cn-north-1': '638102146993',
228-
'cn-northwest-1': '037604701340',
229-
};

0 commit comments

Comments
 (0)