Skip to content

Commit e92dbec

Browse files
authored
feat(ecs): credentialSpecs in ContainerDefinitionOptions (#29085)
### Issue # (if applicable) Closes #N/A ### Reason for this change v2.127.0 updated the L1 construct for AWS::ECS::TaskDefinition, adding support for the property ContainerDefinitions.CredentialSpecs, [see](#29053). This PR adds support for CredentialSpecs property in the L2 construct used by `Ec2TaskDefinition.addContainer` method. ### Description of changes Added property in L2 construct, updated unit test and added integration test. ### Description of how you validated changes - [x] Unit test updated and validated - [x] Integration test added and validated ### 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 2b0ed53 commit e92dbec

15 files changed

+1386
-5
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/integ.task-definition-container-credentialspecs.js.snapshot/TaskDefinitionContainerCredSpecsDefaultTestDeployAssertF6677424.assets.json

+19
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/integ.task-definition-container-credentialspecs.js.snapshot/TaskDefinitionContainerCredSpecsDefaultTestDeployAssertF6677424.template.json

+36
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/integ.task-definition-container-credentialspecs.js.snapshot/aws-ecs-task-definition-container-credentialspecs.assets.json

+19
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,255 @@
1+
{
2+
"Resources": {
3+
"bucket43879C71": {
4+
"Type": "AWS::S3::Bucket",
5+
"Properties": {
6+
"BucketEncryption": {
7+
"ServerSideEncryptionConfiguration": [
8+
{
9+
"ServerSideEncryptionByDefault": {
10+
"SSEAlgorithm": "AES256"
11+
}
12+
}
13+
]
14+
},
15+
"PublicAccessBlockConfiguration": {
16+
"BlockPublicAcls": true,
17+
"BlockPublicPolicy": true,
18+
"IgnorePublicAcls": true,
19+
"RestrictPublicBuckets": true
20+
}
21+
},
22+
"UpdateReplacePolicy": "Delete",
23+
"DeletionPolicy": "Delete"
24+
},
25+
"bucketPolicy638F945D": {
26+
"Type": "AWS::S3::BucketPolicy",
27+
"Properties": {
28+
"Bucket": {
29+
"Ref": "bucket43879C71"
30+
},
31+
"PolicyDocument": {
32+
"Statement": [
33+
{
34+
"Action": "s3:*",
35+
"Condition": {
36+
"Bool": {
37+
"aws:SecureTransport": "false"
38+
}
39+
},
40+
"Effect": "Deny",
41+
"Principal": {
42+
"AWS": "*"
43+
},
44+
"Resource": [
45+
{
46+
"Fn::GetAtt": [
47+
"bucket43879C71",
48+
"Arn"
49+
]
50+
},
51+
{
52+
"Fn::Join": [
53+
"",
54+
[
55+
{
56+
"Fn::GetAtt": [
57+
"bucket43879C71",
58+
"Arn"
59+
]
60+
},
61+
"/*"
62+
]
63+
]
64+
}
65+
]
66+
}
67+
],
68+
"Version": "2012-10-17"
69+
}
70+
}
71+
},
72+
"parameter76C24FC7": {
73+
"Type": "AWS::SSM::Parameter",
74+
"Properties": {
75+
"Type": "String",
76+
"Value": "Sample CredSpec"
77+
}
78+
},
79+
"taskexecutionrole7BB27090": {
80+
"Type": "AWS::IAM::Role",
81+
"Properties": {
82+
"AssumeRolePolicyDocument": {
83+
"Statement": [
84+
{
85+
"Action": "sts:AssumeRole",
86+
"Effect": "Allow",
87+
"Principal": {
88+
"Service": "ecs-tasks.amazonaws.com"
89+
}
90+
}
91+
],
92+
"Version": "2012-10-17"
93+
},
94+
"ManagedPolicyArns": [
95+
{
96+
"Fn::Join": [
97+
"",
98+
[
99+
"arn:",
100+
{
101+
"Ref": "AWS::Partition"
102+
},
103+
":iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
104+
]
105+
]
106+
},
107+
{
108+
"Fn::Join": [
109+
"",
110+
[
111+
"arn:",
112+
{
113+
"Ref": "AWS::Partition"
114+
},
115+
":iam::aws:policy/AmazonS3ReadOnlyAccess"
116+
]
117+
]
118+
}
119+
],
120+
"RoleName": "aws-ecs-task-definition-container-credentialspecs-task-exec-role"
121+
}
122+
},
123+
"TaskDefTaskRole1EDB4A67": {
124+
"Type": "AWS::IAM::Role",
125+
"Properties": {
126+
"AssumeRolePolicyDocument": {
127+
"Statement": [
128+
{
129+
"Action": "sts:AssumeRole",
130+
"Effect": "Allow",
131+
"Principal": {
132+
"Service": "ecs-tasks.amazonaws.com"
133+
}
134+
}
135+
],
136+
"Version": "2012-10-17"
137+
}
138+
}
139+
},
140+
"TaskDef54694570": {
141+
"Type": "AWS::ECS::TaskDefinition",
142+
"Properties": {
143+
"ContainerDefinitions": [
144+
{
145+
"CredentialSpecs": [
146+
{
147+
"Fn::Join": [
148+
"",
149+
[
150+
"credentialspec:arn:",
151+
{
152+
"Ref": "AWS::Partition"
153+
},
154+
":ssm:",
155+
{
156+
"Ref": "AWS::Region"
157+
},
158+
":",
159+
{
160+
"Ref": "AWS::AccountId"
161+
},
162+
":parameter/",
163+
{
164+
"Ref": "parameter76C24FC7"
165+
}
166+
]
167+
]
168+
}
169+
],
170+
"Essential": true,
171+
"Image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest",
172+
"Memory": 512,
173+
"MemoryReservation": 32,
174+
"Name": "DomainJoinedContainer"
175+
},
176+
{
177+
"CredentialSpecs": [
178+
{
179+
"Fn::Join": [
180+
"",
181+
[
182+
"credentialspecdomainless:",
183+
{
184+
"Fn::GetAtt": [
185+
"bucket43879C71",
186+
"Arn"
187+
]
188+
},
189+
"/credSpecDomainless"
190+
]
191+
]
192+
}
193+
],
194+
"Essential": true,
195+
"Image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest",
196+
"Memory": 512,
197+
"MemoryReservation": 32,
198+
"Name": "DomainlessContainer"
199+
}
200+
],
201+
"ExecutionRoleArn": {
202+
"Fn::GetAtt": [
203+
"taskexecutionrole7BB27090",
204+
"Arn"
205+
]
206+
},
207+
"Family": "awsecstaskdefinitioncontainercredentialspecsTaskDefE15276BC",
208+
"NetworkMode": "bridge",
209+
"RequiresCompatibilities": [
210+
"EC2"
211+
],
212+
"TaskRoleArn": {
213+
"Fn::GetAtt": [
214+
"TaskDefTaskRole1EDB4A67",
215+
"Arn"
216+
]
217+
}
218+
}
219+
}
220+
},
221+
"Parameters": {
222+
"BootstrapVersion": {
223+
"Type": "AWS::SSM::Parameter::Value<String>",
224+
"Default": "/cdk-bootstrap/hnb659fds/version",
225+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
226+
}
227+
},
228+
"Rules": {
229+
"CheckBootstrapVersion": {
230+
"Assertions": [
231+
{
232+
"Assert": {
233+
"Fn::Not": [
234+
{
235+
"Fn::Contains": [
236+
[
237+
"1",
238+
"2",
239+
"3",
240+
"4",
241+
"5"
242+
],
243+
{
244+
"Ref": "BootstrapVersion"
245+
}
246+
]
247+
}
248+
]
249+
},
250+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
251+
}
252+
]
253+
}
254+
}
255+
}

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

+1
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/integ.task-definition-container-credentialspecs.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)