Skip to content

Commit e0f7086

Browse files
authored
Merge branch 'main' into adotlambda
2 parents ac60149 + b12bc67 commit e0f7086

File tree

105 files changed

+32827
-212
lines changed

Some content is hidden

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

105 files changed

+32827
-212
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ assertions against the deployed infrastructure.
352352
```
353353

354354
Examples:
355-
* [integ.destinations.ts](https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-lambda-destinations/test/integ.destinations.ts#L7)
356-
* [integ.put-events.ts](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts)
355+
* [integ.destinations.ts](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.ts#L7)
356+
* [integ.put-events.ts](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts)
357357

358358
**What if you cannot run integration tests**
359359

INTEGRATION_TESTS.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ an integration test for the new feature can ensure that it works and avoid unnec
4949

5050
**3. Involves configuring resource types across services (i.e. integrations)**
5151
For example, you are adding functionality that allows for service x to integrate with service y.
52-
A good example of this is the [aws-stepfunctions-tasks](./packages/@aws-cdk/aws-stepfunctions-tasks) or
53-
[aws-apigatewayv2-integrations](./packages/@aws-cdk/aws-apigatewayv2-integrations) modules. Both of these
52+
A good example of this is the [aws-stepfunctions-tasks](./packages/aws-cdk-lib/aws-stepfunctions-tasks) or
53+
[aws-apigatewayv2-integrations-alpha](./packages/@aws-cdk/aws-apigatewayv2-integrations-alpha) modules. Both of these
5454
have L2 constructs that provide functionality to integrate services.
5555

5656
Sometimes these integrations involve configuring/formatting json/vtl or some other type of data.
@@ -82,8 +82,8 @@ Lambda Function would look like this:
8282

8383
_integ.lambda.ts_
8484
```ts
85-
import * as iam from '@aws-cdk/aws-iam';
86-
import * as cdk from '@aws-cdk/core';
85+
import * as iam from 'aws-cdk-lib/aws-iam';
86+
import * as cdk from 'aws-cdk-lib/core';
8787
import * as lambda from '../lib';
8888
import * as integ from '@aws-cdk/integ-tests-alpha';
8989

@@ -230,11 +230,11 @@ to deploy the Lambda Function _and_ then rerun the assertions to ensure that the
230230
### Assertions
231231

232232
Sometimes it is necessary to perform some form of _assertion_ against the deployed infrastructure to validate that the
233-
test succeeds. A good example of this is the `@aws-cdk/aws-stepfunctions-tasks` module which creates integrations between
233+
test succeeds. A good example of this is the `aws-cdk-lib/aws-stepfunctions-tasks` module which creates integrations between
234234
AWS StepFunctions and other AWS services.
235235

236-
If we look at the [integ.put-events.ts](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts)
237-
integration test we can see that we are creating an `@aws-cdk/aws-events.EventBus` along with a `@aws-cdk/aws-stepfunctions.StateMachine`
236+
If we look at the [integ.put-events.ts](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts)
237+
integration test we can see that we are creating an `aws-cdk-lib/aws-events.EventBus` along with a `aws-cdk-lib/aws-stepfunctions.StateMachine`
238238
which will send an event to the `EventBus`. In a typical integration test we would just deploy the test and the fact that the
239239
infrastructure deployed successfully would be enough of a validation that the test succeeded. In this case though, we ideally
240240
want to validate that the _integration_ connecting `StepFunctions` to the `EventBus` has been setup correctly, and the only
@@ -269,8 +269,8 @@ Not every test requires an assertion. We typically do not need to assert CloudFo
269269
with Encryption, we do not need to assert that Encryption is set on the bucket. We can trust that the CloudFormation behavior works.
270270
Some things you should look for in deciding if the test needs an assertion:
271271

272-
- Integrations between services (i.e. integration libraries like `@aws-cdk/aws-lambda-destinations`, `@aws-cdk/aws-stepfunctions-tasks`, etc)
273-
- Anything that bundles or deploys custom code (i.e. does a Lambda function bundled with `@aws-cdk/aws-lambda-nodejs` still invoke or did we break bundling behavior)
272+
- Integrations between services (i.e. integration libraries like `aws-cdk-lib/aws-lambda-destinations`, `aws-cdk-lib/aws-stepfunctions-tasks`, etc)
273+
- Anything that bundles or deploys custom code (i.e. does a Lambda function bundled with `aws-cdk-lib/aws-lambda-nodejs` still invoke or did we break bundling behavior)
274274
- IAM/Networking connections.
275275
- This one is a bit of a judgement call. Most things do not need assertions, but sometimes we handle complicated configurations involving IAM permissions or
276276
Networking access.

design/aws-ecs/aws-ecs-fargate-capacity-providers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ This new field would be added to the BaseService, not only for better extensibil
103103

104104
Implications Setting Launch Type
105105

106-
Since it can be reasonably assumed that any CapacityProvideStrategies defined on the Service are what the customer intends to use on the Service, the LaunchType will *not* be set on the Service if CapacityProvideStrategies are specified. This is similar to how the LaunchType field is unset if the service uses an external DeploymentController (https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs/lib/base/base-service.ts#L374).
106+
Since it can be reasonably assumed that any CapacityProvideStrategies defined on the Service are what the customer intends to use on the Service, the LaunchType will *not* be set on the Service if CapacityProvideStrategies are specified. This is similar to how the LaunchType field is unset if the service uses an external DeploymentController (https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts#L587).
107107

108108
On the other hand, this intent would not be as obvious with Default Capacity Provider Strategies defined a cluster. A *defaultCapacityProviderStrategy* specified on a cluster is used for any service that does not specify either a launchType or its own CapacityProviderStrategies. From the point of view of the ECS APIs, similar to how custom CapacityProvideStrategies defined on the Service are expected to supersede the defaultCapacityProviderStrategy on a cluster, the expected behavior for an ECS Service that specifies a launchType is for it to also ignore the Cluster’s defaultCapacityProviderStrategy.
109109

110-
However, since the two Service constructs in the CDK (Ec2Service and FargateService) do not support having the launchType field passed in explicitly, it would not possible to infer whether the intent of the customer using one of these Service constructs is to use the implied launchType (currently set under the hood in the service’s constructor (https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs/lib/fargate/fargate-service.ts#L155)) or the defaultCapacityProviderStrategy. For this reason, we will not be adding the defaultCapacityProviderStrategy field on the Cluster construct for this iteration.
110+
However, since the two Service constructs in the CDK (Ec2Service and FargateService) do not support having the launchType field passed in explicitly, it would not possible to infer whether the intent of the customer using one of these Service constructs is to use the implied launchType (currently set under the hood in the service’s constructor (https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-service.ts#L134) or the defaultCapacityProviderStrategy. For this reason, we will not be adding the defaultCapacityProviderStrategy field on the Cluster construct for this iteration.
111111

112112
_*Note*_: Future for support will be dependent on a re-design of the existing Service strategies. This will be treated in v2 of the ECS modules, likely with a single Service L2 construct and deprecation of the Ec2Service and FargateService constructs.
113113

design/aws-ecs/aws-ecs-priv-registry-support.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
To address issue [#1698](https://github.com/aws/aws-cdk/issues/1698), the ECS construct library should provide a way for customers to specify [`repositoryCredentials`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html#ECS-Type-ContainerDefinition-repositoryCredentials) on their container.
44

5-
Minimally, this would mean adding a new string field on `ContainerDefinition`, however this doesn't provide any added value in terms of logical grouping or resource creation. We can instead modify the existing ECS CDK construct [`ContainerImage`](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs/lib/container-image.ts) so that repository credentials are specified along with the image they're meant to access.
5+
Minimally, this would mean adding a new string field on `ContainerDefinition`, however this doesn't provide any added value in terms of logical grouping or resource creation. We can instead modify the existing ECS CDK construct [`ContainerImage`](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ecs/lib/container-image.ts) so that repository credentials are specified along with the image they're meant to access.
66

77
## General approach
88

9-
The [`ecs.ContainerImage`](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs/lib/container-image.ts) class already includes constructs for 3 types of images:
9+
The [`ecs.ContainerImage`](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ecs/lib/container-image.ts) class already includes constructs for 3 types of images:
1010

1111
* DockerHubImage
1212
* EcrImage

docs/DESIGN_GUIDELINES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ exist in the CDK will be removed in the next CDK major version (CDKv2).
193193

194194
AWS resources are organized into modules based on their AWS service. For
195195
example, the "Bucket" resource, which is offered by the Amazon S3 service will
196-
be available under the **@aws-cdk/aws-s3** module. We will use the “aws-” prefix
196+
be available under the **aws-cdk-lib/aws-s3** module. We will use the “aws-” prefix
197197
for all AWS services, regardless of whether their marketing name uses an
198198
“Amazon” prefix (e.g. “Amazon S3”). Non-AWS services supported by AWS
199199
CloudFormation (like the Alexa::ASK namespace) will be **@aws-cdk/alexa-ask**.
@@ -203,13 +203,13 @@ consistent with the AWS SDKs and AWS CloudFormation _[awslint:module-name]_.
203203

204204
All major versions of an AWS namespace will be mastered in the AWS Construct
205205
Library under the root namespace. For example resources of the **ApiGatewayV2**
206-
namespace will be available under the **@aws-cdk/aws-apigateway** module (and
206+
namespace will be available under the **aws-cdk-lib/aws-apigateway** module (and
207207
not under “v2) _[awslint:module-v2]_.
208208

209209
In some cases, it makes sense to introduce secondary modules for a certain
210210
service (e.g. aws-s3-notifications, aws-lambda-event-sources, etc). The name of
211211
the secondary module will be
212-
**@aws-cdk/aws-xxx-\<secondary-module\>**_[awslint:module-secondary]_.
212+
**aws-cdk-lib/aws-xxx-\<secondary-module\>**_[awslint:module-secondary]_.
213213

214214
Documentation for how to use secondary modules should be in the main module. The
215215
README file should refer users to the central module

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Integration test to deploy some resources, create an alarm on it and create a dashboard.
22
//
3-
// Because literally every other library is going to depend on @aws-cdk/aws-cloudwatch, we drop down
3+
// Because literally every other library is going to depend on aws-cdk-lib/aws-cloudwatch, we drop down
44
// to the very lowest level to create CloudFormation resources by hand, without even generated
55
// library support.
66

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Integration test to deploy some resources, create an alarm on it and create a dashboard.
22
//
3-
// Because literally every other library is going to depend on @aws-cdk/aws-cloudwatch, we drop down
3+
// Because literally every other library is going to depend on aws-cdk-lib/aws-cloudwatch, we drop down
44
// to the very lowest level to create CloudFormation resources by hand, without even generated
55
// library support.
66

packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const repo = new codecommit.Repository(stack, 'Repo', {
1010
});
1111
const topic = new sns.Topic(stack, 'MyTopic');
1212

13-
// we can't use @aws-cdk/aws-events-targets.SnsTopic here because it will
13+
// we can't use aws-cdk-lib/aws-events-targets.SnsTopic here because it will
1414
// create a cyclic dependency with codebuild, so we just fake it
1515
repo.onReferenceCreated('OnReferenceCreated', {
1616
target: {

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
}
1515
}
1616
},
17-
"a4b59355abf5d8c0386c7a97a5ba8710aa8bd36803e900fdc1db7cd5898ab07f": {
17+
"35acc9890f56039e55907e0d94b218fc4900a4e3fa8ebfbf44dafe81b20a0e0d": {
1818
"source": {
1919
"path": "FlowLogsTestStack.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "a4b59355abf5d8c0386c7a97a5ba8710aa8bd36803e900fdc1db7cd5898ab07f.json",
25+
"objectKey": "35acc9890f56039e55907e0d94b218fc4900a4e3fa8ebfbf44dafe81b20a0e0d.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.template.json

+41-5
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@
417417
"Tags": [
418418
{
419419
"Key": "Name",
420-
"Value": "FlowLogsTestStack/VPC"
420+
"Value": "FlowLogsTestStack/VPC/FlowLogsS3"
421421
}
422422
],
423423
"TrafficType": "ALL"
@@ -441,7 +441,13 @@
441441
}
442442
],
443443
"Version": "2012-10-17"
444-
}
444+
},
445+
"Tags": [
446+
{
447+
"Key": "Name",
448+
"Value": "FlowLogsTestStack/FlowLogsCW"
449+
}
450+
]
445451
}
446452
},
447453
"FlowLogsCWIAMRoleDefaultPolicy943C8A20": {
@@ -487,7 +493,13 @@
487493
"FlowLogsCWLogGroup0398E8F8": {
488494
"Type": "AWS::Logs::LogGroup",
489495
"Properties": {
490-
"RetentionInDays": 731
496+
"RetentionInDays": 731,
497+
"Tags": [
498+
{
499+
"Key": "Name",
500+
"Value": "FlowLogsTestStack/FlowLogsCW"
501+
}
502+
]
491503
},
492504
"UpdateReplacePolicy": "Retain",
493505
"DeletionPolicy": "Retain"
@@ -510,6 +522,12 @@
510522
"Ref": "VPCB9E5F0B4"
511523
},
512524
"ResourceType": "VPC",
525+
"Tags": [
526+
{
527+
"Key": "Name",
528+
"Value": "FlowLogsTestStack/FlowLogsCW"
529+
}
530+
],
513531
"TrafficType": "ALL"
514532
}
515533
},
@@ -527,7 +545,13 @@
527545
}
528546
],
529547
"Version": "2012-10-17"
530-
}
548+
},
549+
"Tags": [
550+
{
551+
"Key": "Name",
552+
"Value": "FlowLogsTestStack/FlowLogsAllFormatCW"
553+
}
554+
]
531555
}
532556
},
533557
"FlowLogsAllFormatCWIAMRoleDefaultPolicyBE4C71ED": {
@@ -573,7 +597,13 @@
573597
"FlowLogsAllFormatCWLogGroup3DAB6837": {
574598
"Type": "AWS::Logs::LogGroup",
575599
"Properties": {
576-
"RetentionInDays": 731
600+
"RetentionInDays": 731,
601+
"Tags": [
602+
{
603+
"Key": "Name",
604+
"Value": "FlowLogsTestStack/FlowLogsAllFormatCW"
605+
}
606+
]
577607
},
578608
"UpdateReplacePolicy": "Retain",
579609
"DeletionPolicy": "Retain"
@@ -596,6 +626,12 @@
596626
"Ref": "VPCB9E5F0B4"
597627
},
598628
"ResourceType": "VPC",
629+
"Tags": [
630+
{
631+
"Key": "Name",
632+
"Value": "FlowLogsTestStack/FlowLogsAllFormatCW"
633+
}
634+
],
599635
"TrafficType": "ALL"
600636
}
601637
},

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a4b59355abf5d8c0386c7a97a5ba8710aa8bd36803e900fdc1db7cd5898ab07f.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/35acc9890f56039e55907e0d94b218fc4900a4e3fa8ebfbf44dafe81b20a0e0d.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/tree.json

+41-5
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@
678678
"tags": [
679679
{
680680
"key": "Name",
681-
"value": "FlowLogsTestStack/VPC"
681+
"value": "FlowLogsTestStack/VPC/FlowLogsS3"
682682
}
683683
],
684684
"trafficType": "ALL"
@@ -734,7 +734,13 @@
734734
}
735735
],
736736
"Version": "2012-10-17"
737-
}
737+
},
738+
"tags": [
739+
{
740+
"key": "Name",
741+
"value": "FlowLogsTestStack/FlowLogsCW"
742+
}
743+
]
738744
}
739745
},
740746
"constructInfo": {
@@ -816,7 +822,13 @@
816822
"attributes": {
817823
"aws:cdk:cloudformation:type": "AWS::Logs::LogGroup",
818824
"aws:cdk:cloudformation:props": {
819-
"retentionInDays": 731
825+
"retentionInDays": 731,
826+
"tags": [
827+
{
828+
"key": "Name",
829+
"value": "FlowLogsTestStack/FlowLogsCW"
830+
}
831+
]
820832
}
821833
},
822834
"constructInfo": {
@@ -851,6 +863,12 @@
851863
"Ref": "VPCB9E5F0B4"
852864
},
853865
"resourceType": "VPC",
866+
"tags": [
867+
{
868+
"key": "Name",
869+
"value": "FlowLogsTestStack/FlowLogsCW"
870+
}
871+
],
854872
"trafficType": "ALL"
855873
}
856874
},
@@ -898,7 +916,13 @@
898916
}
899917
],
900918
"Version": "2012-10-17"
901-
}
919+
},
920+
"tags": [
921+
{
922+
"key": "Name",
923+
"value": "FlowLogsTestStack/FlowLogsAllFormatCW"
924+
}
925+
]
902926
}
903927
},
904928
"constructInfo": {
@@ -980,7 +1004,13 @@
9801004
"attributes": {
9811005
"aws:cdk:cloudformation:type": "AWS::Logs::LogGroup",
9821006
"aws:cdk:cloudformation:props": {
983-
"retentionInDays": 731
1007+
"retentionInDays": 731,
1008+
"tags": [
1009+
{
1010+
"key": "Name",
1011+
"value": "FlowLogsTestStack/FlowLogsAllFormatCW"
1012+
}
1013+
]
9841014
}
9851015
},
9861016
"constructInfo": {
@@ -1015,6 +1045,12 @@
10151045
"Ref": "VPCB9E5F0B4"
10161046
},
10171047
"resourceType": "VPC",
1048+
"tags": [
1049+
{
1050+
"key": "Name",
1051+
"value": "FlowLogsTestStack/FlowLogsAllFormatCW"
1052+
}
1053+
],
10181054
"trafficType": "ALL"
10191055
}
10201056
},

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
}
1515
}
1616
},
17-
"e2671f8cd84932eccd2cf1e512a31437133da0c6cd4658c3863903f1923e8235": {
17+
"99fa1ff8164e33fddcfd757915d874057dc931fc37a80fdd64428fa78b9698c7": {
1818
"source": {
1919
"path": "FlowLogsTestStack.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "e2671f8cd84932eccd2cf1e512a31437133da0c6cd4658c3863903f1923e8235.json",
25+
"objectKey": "99fa1ff8164e33fddcfd757915d874057dc931fc37a80fdd64428fa78b9698c7.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

0 commit comments

Comments
 (0)