Skip to content

Commit

Permalink
fix(ecs): unclear docs on valid ec2 task definition placement constra…
Browse files Browse the repository at this point in the history
…ints 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
  • Loading branch information
Adibuer-lab authored Aug 2, 2023
1 parent 5f29295 commit 4c57f45
Show file tree
Hide file tree
Showing 15 changed files with 3,655 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@
"dependencies": {
"string-width": "^4.2.3"
}
}
}

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "32.0.0",
"files": {
"ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd": {
"source": {
"path": "asset.ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "ba598c1f1d84f7077ea9c16a6b921e4f8acf18e996100e72a8f17da980e64fdd.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"0a9ca3828434fca52688d82a6c9438b44fc25f418219dcc41eefa938e401e99b": {
"source": {
"path": "aws-cdk-ecs-integration-test-stack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "0a9ca3828434fca52688d82a6c9438b44fc25f418219dcc41eefa938e401e99b.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Loading

0 comments on commit 4c57f45

Please sign in to comment.