Skip to content

Commit 4c57f45

Browse files
authored
fix(ecs): unclear docs on valid ec2 task definition placement constraints and no validation of input #25933 (#26384)
Docs were unclear on valid placement constraints. You can specify distinctInstances when creating a Service, or running a task. You can specify memberOf when doing the previous two actions, or when creating a task or new revision. So far only memberOf is valid for ec2 task definitions. This pull request enhances the documentation and validation for task definition placement constraints in the aws-cdk-lib/aws-ecs package. The documentation now includes a note clarifying the valid placement constraints and a new validatePlacementConstraints method has been added to the Ec2TaskDefinition class to validate the constraints at synth time. The changes include: Enhancement of documentation in ec2-task-definition.ts to include a note about valid placement constraints. Addition of the validatePlacementConstraints method in ec2-task-definition.ts to validate placement constraints at synth time. Addition of unit tests in ec2-task-definition.test.ts to verify the correct behavior of the new validatePlacementConstraints method. Addition of integration tests to ensure overall functionality. Closes #25905. Revival of #25933 ---- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 5f29295 commit 4c57f45

15 files changed

+3655
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,4 @@
173173
"dependencies": {
174174
"string-width": "^4.2.3"
175175
}
176-
}
176+
}

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.task-definition-placement-constraints.js.snapshot/asset.ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd/__entrypoint__.js

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.task-definition-placement-constraints.js.snapshot/asset.ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd/index.js

Lines changed: 81 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "32.0.0",
3+
"files": {
4+
"ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd": {
5+
"source": {
6+
"path": "asset.ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd",
7+
"packaging": "zip"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd.zip",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
},
17+
"0a9ca3828434fca52688d82a6c9438b44fc25f418219dcc41eefa938e401e99b": {
18+
"source": {
19+
"path": "aws-cdk-ecs-integration-test-stack.template.json",
20+
"packaging": "file"
21+
},
22+
"destinations": {
23+
"current_account-current_region": {
24+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25+
"objectKey": "0a9ca3828434fca52688d82a6c9438b44fc25f418219dcc41eefa938e401e99b.json",
26+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
27+
}
28+
}
29+
}
30+
},
31+
"dockerImages": {}
32+
}

0 commit comments

Comments
 (0)