Skip to content

Commit a56bfc4

Browse files
authored
Merge branch 'master' into merge-back/1.138.1
2 parents 595dee1 + aff607a commit a56bfc4

File tree

344 files changed

+137267
-123370
lines changed

Some content is hidden

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

344 files changed

+137267
-123370
lines changed

.github/workflows/yarn-upgrade.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v2
1919

2020
- name: Set up Node
21-
uses: actions/[email protected].0
21+
uses: actions/[email protected].1
2222
with:
2323
node-version: 12
2424

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ See [Gitpod section](#gitpod) on how to set up the CDK repo on Gitpod.
5252

5353
The following tools need to be installed on your system prior to installing the CDK:
5454

55-
- [Node.js >= 10.13.0](https://nodejs.org/download/release/latest-v10.x/)
55+
- [Node.js >= 14.15.0](https://nodejs.org/download/release/latest-v14.x/)
5656
- We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
57-
- ⚠️ versions `13.0.0` to `13.6.0` are not supported due to compatibility issues with our dependencies.
5857
- [Yarn >= 1.19.1, < 2](https://yarnpkg.com/lang/en/docs/install)
5958
- [.NET Core SDK 3.1.x](https://www.microsoft.com/net/download)
6059
- [Python >= 3.6.5, < 4.0](https://www.python.org/downloads/release/python-365/)

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ infrastructure definition and share it without worrying about boilerplate logic.
1919

2020
The CDK is available in the following languages:
2121

22-
* JavaScript, TypeScript ([Node.js ≥ 10.13.0](https://nodejs.org/download/release/latest-v10.x/))
22+
* JavaScript, TypeScript ([Node.js ≥ 14.15.0](https://nodejs.org/download/release/latest-v14.x/))
2323
- We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
24-
- ⚠️ versions `13.0.0` to `13.6.0` are not supported due to compatibility issues with our dependencies.
2524
* Python ([Python ≥ 3.6](https://www.python.org/downloads/))
2625
* Java ([Java ≥ 8](https://www.oracle.com/technetwork/java/javase/downloads/index.html) and [Maven ≥ 3.5.4](https://maven.apache.org/download.cgi))
2726
* .NET ([.NET Core ≥ 3.1](https://dotnet.microsoft.com/download))
@@ -77,8 +76,7 @@ in the CDK Developer Guide.
7776
For a detailed walkthrough, see the [tutorial](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html#hello_world_tutorial) in the AWS CDK [Developer Guide](https://docs.aws.amazon.com/cdk/latest/guide/home.html).
7877

7978
### At a glance
80-
Install or update the [AWS CDK CLI] from npm (requires [Node.js ≥ 10.13.0](https://nodejs.org/download/release/latest-v10.x/)). We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
81-
⚠️ versions `13.0.0` to `13.6.0` are not supported due to compatibility issues with our dependencies.
79+
Install or update the [AWS CDK CLI] from npm (requires [Node.js ≥ 14.15.0](https://nodejs.org/download/release/latest-v14.x/)). We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
8280

8381
```console
8482
$ npm i -g aws-cdk

packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.expected.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,22 +3185,12 @@
31853185
"Backends": [
31863186
{
31873187
"VirtualService": {
3188-
"VirtualServiceName": {
3189-
"Fn::GetAtt": [
3190-
"namevirtualservice3DDDDF1E",
3191-
"VirtualServiceName"
3192-
]
3193-
}
3188+
"VirtualServiceName": "name.production"
31943189
}
31953190
},
31963191
{
31973192
"VirtualService": {
3198-
"VirtualServiceName": {
3199-
"Fn::GetAtt": [
3200-
"greetingvirtualservice60AD3AD9",
3201-
"VirtualServiceName"
3202-
]
3203-
}
3193+
"VirtualServiceName": "greeting.production"
32043194
}
32053195
}
32063196
],

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,24 @@ The `backends` property can be added with `node.addBackend()`. In the example, w
236236

237237
The `backendDefaults` property is added to the node while creating the virtual node. These are the virtual node's default settings for all backends.
238238

239+
The `VirtualNode.addBackend()` method is especially useful if you want to create a circular traffic flow by having a Virtual Service as a backend whose provider is that same Virtual Node:
240+
241+
```ts
242+
declare const mesh: appmesh.Mesh;
243+
244+
const node = new appmesh.VirtualNode(this, 'node', {
245+
mesh,
246+
serviceDiscovery: appmesh.ServiceDiscovery.dns('node'),
247+
});
248+
249+
const virtualService = new appmesh.VirtualService(this, 'service-1', {
250+
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node),
251+
virtualServiceName: 'service1.domain.local',
252+
});
253+
254+
node.addBackend(appmesh.Backend.virtualService(virtualService));
255+
```
256+
239257
### Adding TLS to a listener
240258

241259
The `tls` property specifies TLS configuration when creating a listener for a virtual node or a virtual gateway.

packages/@aws-cdk/aws-appmesh/lib/shared-interfaces.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,14 @@ class VirtualServiceBackend extends Backend {
238238
return {
239239
virtualServiceBackend: {
240240
virtualService: {
241-
virtualServiceName: this.virtualService.virtualServiceName,
241+
/**
242+
* We want to use the name of the Virtual Service here directly instead of
243+
* a `{ 'Fn::GetAtt' }` CFN expression. This avoids a circular dependency in
244+
* the case where this Virtual Node is the Virtual Service's provider.
245+
*/
246+
virtualServiceName: cdk.Token.isUnresolved(this.virtualService.virtualServiceName)
247+
? (this.virtualService as any).physicalName
248+
: this.virtualService.virtualServiceName,
242249
clientPolicy: this.tlsClientPolicy
243250
? {
244251
tls: renderTlsClientPolicy(scope, this.tlsClientPolicy),

packages/@aws-cdk/aws-appmesh/test/integ.mesh.expected.json

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,22 +1040,12 @@
10401040
"Backends": [
10411041
{
10421042
"VirtualService": {
1043-
"VirtualServiceName": {
1044-
"Fn::GetAtt": [
1045-
"service6D174F83",
1046-
"VirtualServiceName"
1047-
]
1048-
}
1043+
"VirtualServiceName": "service1.domain.local"
10491044
}
10501045
},
10511046
{
10521047
"VirtualService": {
1053-
"VirtualServiceName": {
1054-
"Fn::GetAtt": [
1055-
"service27C65CF7D",
1056-
"VirtualServiceName"
1057-
]
1058-
}
1048+
"VirtualServiceName": "service2.domain.local"
10591049
}
10601050
}
10611051
],
@@ -1111,12 +1101,7 @@
11111101
"Backends": [
11121102
{
11131103
"VirtualService": {
1114-
"VirtualServiceName": {
1115-
"Fn::GetAtt": [
1116-
"service3859EB104",
1117-
"VirtualServiceName"
1118-
]
1119-
}
1104+
"VirtualServiceName": "service3.domain.local"
11201105
}
11211106
}
11221107
],
@@ -1241,12 +1226,7 @@
12411226
"Backends": [
12421227
{
12431228
"VirtualService": {
1244-
"VirtualServiceName": {
1245-
"Fn::GetAtt": [
1246-
"service4983B61EE",
1247-
"VirtualServiceName"
1248-
]
1249-
}
1229+
"VirtualServiceName": "service4.domain.local"
12501230
}
12511231
}
12521232
],

packages/@aws-cdk/aws-appmesh/test/mesh.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,7 @@ describe('mesh', () => {
314314
Backends: [
315315
{
316316
VirtualService: {
317-
VirtualServiceName: {
318-
'Fn::GetAtt': ['service1A48078CF', 'VirtualServiceName'],
319-
},
317+
VirtualServiceName: 'service1.domain.local',
320318
},
321319
},
322320
],

packages/@aws-cdk/aws-appmesh/test/virtual-node.test.ts

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,18 @@ describe('virtual node', () => {
4141
Backends: [
4242
{
4343
VirtualService: {
44-
VirtualServiceName: {
45-
'Fn::GetAtt': ['service1A48078CF', 'VirtualServiceName'],
46-
},
44+
VirtualServiceName: 'service1.domain.local',
4745
},
4846
},
4947
{
5048
VirtualService: {
51-
VirtualServiceName: {
52-
'Fn::GetAtt': ['service27C65CF7D', 'VirtualServiceName'],
53-
},
49+
VirtualServiceName: 'service2.domain.local',
5450
},
5551
},
5652
],
5753
},
5854
MeshOwner: ABSENT,
5955
});
60-
61-
6256
});
6357
});
6458

@@ -458,9 +452,7 @@ describe('virtual node', () => {
458452
Backends: [
459453
{
460454
VirtualService: {
461-
VirtualServiceName: {
462-
'Fn::GetAtt': ['service1A48078CF', 'VirtualServiceName'],
463-
},
455+
VirtualServiceName: 'service1.domain.local',
464456
ClientPolicy: {
465457
TLS: {
466458
Ports: [8080, 8081],
@@ -478,8 +470,75 @@ describe('virtual node', () => {
478470
],
479471
},
480472
});
473+
});
474+
475+
test('you can add a Virtual Service as a backend to a Virtual Node which is the provider for that Virtual Service', () => {
476+
// GIVEN
477+
const stack = new cdk.Stack();
478+
479+
// WHEN
480+
const mesh = new appmesh.Mesh(stack, 'mesh', {
481+
meshName: 'test-mesh',
482+
});
483+
484+
const node = new appmesh.VirtualNode(stack, 'test-node', {
485+
mesh,
486+
serviceDiscovery: appmesh.ServiceDiscovery.dns('test'),
487+
});
488+
489+
const myVirtualService = new appmesh.VirtualService(stack, 'service-1', {
490+
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node),
491+
virtualServiceName: 'service1.domain.local',
492+
});
493+
494+
node.addBackend(appmesh.Backend.virtualService(myVirtualService));
495+
496+
// THEN
497+
expect(stack).toHaveResourceLike('AWS::AppMesh::VirtualNode', {
498+
Spec: {
499+
Backends: [
500+
{
501+
VirtualService: {
502+
VirtualServiceName: 'service1.domain.local',
503+
},
504+
},
505+
],
506+
},
507+
});
508+
});
509+
510+
test('you can add a Virtual Service with an automated name as a backend to a Virtual Node which is the provider for that Virtual Service, ', () => {
511+
// GIVEN
512+
const stack = new cdk.Stack();
481513

514+
// WHEN
515+
const mesh = new appmesh.Mesh(stack, 'mesh', {
516+
meshName: 'test-mesh',
517+
});
482518

519+
const node = new appmesh.VirtualNode(stack, 'test-node', {
520+
mesh,
521+
serviceDiscovery: appmesh.ServiceDiscovery.dns('test'),
522+
});
523+
524+
const myVirtualService = new appmesh.VirtualService(stack, 'service-1', {
525+
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node),
526+
});
527+
528+
node.addBackend(appmesh.Backend.virtualService(myVirtualService));
529+
530+
// THEN
531+
expect(stack).toHaveResourceLike('AWS::AppMesh::VirtualNode', {
532+
Spec: {
533+
Backends: [
534+
{
535+
VirtualService: {
536+
VirtualServiceName: 'service1',
537+
},
538+
},
539+
],
540+
},
541+
});
483542
});
484543
});
485544

packages/@aws-cdk/aws-cloudfront/lib/distribution.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,10 @@ export class Distribution extends Resource implements IDistribution {
430430
throw new Error('Explicitly disabled logging but provided a logging bucket.');
431431
}
432432

433-
const bucket = props.logBucket ?? new s3.Bucket(this, 'LoggingBucket');
433+
const bucket = props.logBucket ?? new s3.Bucket(this, 'LoggingBucket', {
434+
encryption: s3.BucketEncryption.S3_MANAGED,
435+
enforceSSL: true,
436+
});
434437
return {
435438
bucket: bucket.bucketRegionalDomainName,
436439
includeCookies: props.logIncludesCookies,

packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,10 @@ export class CloudFrontWebDistribution extends cdk.Resource implements IDistribu
954954
}
955955

956956
if (props.loggingConfig) {
957-
this.loggingBucket = props.loggingConfig.bucket || new s3.Bucket(this, 'LoggingBucket');
957+
this.loggingBucket = props.loggingConfig.bucket || new s3.Bucket(this, 'LoggingBucket', {
958+
encryption: s3.BucketEncryption.S3_MANAGED,
959+
enforceSSL: true,
960+
});
958961
distributionConfig = {
959962
...distributionConfig,
960963
logging: {

packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,67 @@
7575
},
7676
"AnAmazingWebsiteProbably2LoggingBucket222F7CE9": {
7777
"Type": "AWS::S3::Bucket",
78+
"Properties": {
79+
"BucketEncryption": {
80+
"ServerSideEncryptionConfiguration": [
81+
{
82+
"ServerSideEncryptionByDefault": {
83+
"SSEAlgorithm": "AES256"
84+
}
85+
}
86+
]
87+
}
88+
},
7889
"UpdateReplacePolicy": "Retain",
7990
"DeletionPolicy": "Retain"
8091
},
92+
"AnAmazingWebsiteProbably2LoggingBucketPolicyE298B456": {
93+
"Type": "AWS::S3::BucketPolicy",
94+
"Properties": {
95+
"Bucket": {
96+
"Ref": "AnAmazingWebsiteProbably2LoggingBucket222F7CE9"
97+
},
98+
"PolicyDocument": {
99+
"Statement": [
100+
{
101+
"Action": "s3:*",
102+
"Condition": {
103+
"Bool": {
104+
"aws:SecureTransport": "false"
105+
}
106+
},
107+
"Effect": "Deny",
108+
"Principal": {
109+
"AWS": "*"
110+
},
111+
"Resource": [
112+
{
113+
"Fn::GetAtt": [
114+
"AnAmazingWebsiteProbably2LoggingBucket222F7CE9",
115+
"Arn"
116+
]
117+
},
118+
{
119+
"Fn::Join": [
120+
"",
121+
[
122+
{
123+
"Fn::GetAtt": [
124+
"AnAmazingWebsiteProbably2LoggingBucket222F7CE9",
125+
"Arn"
126+
]
127+
},
128+
"/*"
129+
]
130+
]
131+
}
132+
]
133+
}
134+
],
135+
"Version": "2012-10-17"
136+
}
137+
}
138+
},
81139
"AnAmazingWebsiteProbably2CFDistribution7C1CCD12": {
82140
"Type": "AWS::CloudFront::Distribution",
83141
"Properties": {

0 commit comments

Comments
 (0)