Skip to content

Commit 37df0d2

Browse files
authored
feat(ecs): support container version consistency (#32225)
### Issue # (if applicable) Closes #32202. ### Reason for this change Support the new ECS::TaskDefinition ContainerDefinition VersionConsistency property. This is a simple enabled/disabled flag. ### Description of changes Add a simple enabled/disabled enum prop to the construct. More consequentially, default the prop to disabled (instead of unset) if the container image is a CDK asset, for the reasons described in the comments. ### Description of how you validated changes Unit and integration tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 86ce155 commit 37df0d2

14 files changed

+671
-0
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/base/integ.task-definition-container-version-consistency.js.snapshot/TaskDefinitionContainerRestartPolicyDefaultTestDeployAssert2196C660.assets.json

Lines changed: 19 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/base/integ.task-definition-container-version-consistency.js.snapshot/TaskDefinitionContainerRestartPolicyDefaultTestDeployAssert2196C660.template.json

Lines changed: 36 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/base/integ.task-definition-container-version-consistency.js.snapshot/aws-ecs-task-definition-container-version-consistency.assets.json

Lines changed: 19 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,81 @@
1+
{
2+
"Resources": {
3+
"TaskDefTaskRole1EDB4A67": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "ecs-tasks.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
}
18+
}
19+
},
20+
"TaskDef54694570": {
21+
"Type": "AWS::ECS::TaskDefinition",
22+
"Properties": {
23+
"ContainerDefinitions": [
24+
{
25+
"Essential": true,
26+
"Image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest",
27+
"Name": "Container",
28+
"VersionConsistency": "disabled"
29+
}
30+
],
31+
"Cpu": "256",
32+
"Family": "awsecstaskdefinitioncontainerversionconsistencyTaskDefF7D6E447",
33+
"Memory": "512",
34+
"NetworkMode": "awsvpc",
35+
"RequiresCompatibilities": [
36+
"FARGATE"
37+
],
38+
"TaskRoleArn": {
39+
"Fn::GetAtt": [
40+
"TaskDefTaskRole1EDB4A67",
41+
"Arn"
42+
]
43+
}
44+
}
45+
}
46+
},
47+
"Parameters": {
48+
"BootstrapVersion": {
49+
"Type": "AWS::SSM::Parameter::Value<String>",
50+
"Default": "/cdk-bootstrap/hnb659fds/version",
51+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
52+
}
53+
},
54+
"Rules": {
55+
"CheckBootstrapVersion": {
56+
"Assertions": [
57+
{
58+
"Assert": {
59+
"Fn::Not": [
60+
{
61+
"Fn::Contains": [
62+
[
63+
"1",
64+
"2",
65+
"3",
66+
"4",
67+
"5"
68+
],
69+
{
70+
"Ref": "BootstrapVersion"
71+
}
72+
]
73+
}
74+
]
75+
},
76+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
77+
}
78+
]
79+
}
80+
}
81+
}

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/base/integ.task-definition-container-version-consistency.js.snapshot/cdk.out

Lines changed: 1 addition & 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/base/integ.task-definition-container-version-consistency.js.snapshot/integ.json

Lines changed: 12 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/base/integ.task-definition-container-version-consistency.js.snapshot/manifest.json

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

0 commit comments

Comments
 (0)