forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ecs): credentialSpecs in ContainerDefinitionOptions (aws#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](aws#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*
- Loading branch information
Showing
15 changed files
with
1,386 additions
and
5 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...s.js.snapshot/TaskDefinitionContainerCredSpecsDefaultTestDeployAssertF6677424.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...js.snapshot/TaskDefinitionContainerCredSpecsDefaultTestDeployAssertF6677424.template.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...credentialspecs.js.snapshot/aws-ecs-task-definition-container-credentialspecs.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
255 changes: 255 additions & 0 deletions
255
...edentialspecs.js.snapshot/aws-ecs-task-definition-container-credentialspecs.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
{ | ||
"Resources": { | ||
"bucket43879C71": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketEncryption": { | ||
"ServerSideEncryptionConfiguration": [ | ||
{ | ||
"ServerSideEncryptionByDefault": { | ||
"SSEAlgorithm": "AES256" | ||
} | ||
} | ||
] | ||
}, | ||
"PublicAccessBlockConfiguration": { | ||
"BlockPublicAcls": true, | ||
"BlockPublicPolicy": true, | ||
"IgnorePublicAcls": true, | ||
"RestrictPublicBuckets": true | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"bucketPolicy638F945D": { | ||
"Type": "AWS::S3::BucketPolicy", | ||
"Properties": { | ||
"Bucket": { | ||
"Ref": "bucket43879C71" | ||
}, | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "s3:*", | ||
"Condition": { | ||
"Bool": { | ||
"aws:SecureTransport": "false" | ||
} | ||
}, | ||
"Effect": "Deny", | ||
"Principal": { | ||
"AWS": "*" | ||
}, | ||
"Resource": [ | ||
{ | ||
"Fn::GetAtt": [ | ||
"bucket43879C71", | ||
"Arn" | ||
] | ||
}, | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"bucket43879C71", | ||
"Arn" | ||
] | ||
}, | ||
"/*" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"parameter76C24FC7": { | ||
"Type": "AWS::SSM::Parameter", | ||
"Properties": { | ||
"Type": "String", | ||
"Value": "Sample CredSpec" | ||
} | ||
}, | ||
"taskexecutionrole7BB27090": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "ecs-tasks.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" | ||
] | ||
] | ||
}, | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/AmazonS3ReadOnlyAccess" | ||
] | ||
] | ||
} | ||
], | ||
"RoleName": "aws-ecs-task-definition-container-credentialspecs-task-exec-role" | ||
} | ||
}, | ||
"TaskDefTaskRole1EDB4A67": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "ecs-tasks.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"TaskDef54694570": { | ||
"Type": "AWS::ECS::TaskDefinition", | ||
"Properties": { | ||
"ContainerDefinitions": [ | ||
{ | ||
"CredentialSpecs": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"credentialspec:arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":ssm:", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
":", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":parameter/", | ||
{ | ||
"Ref": "parameter76C24FC7" | ||
} | ||
] | ||
] | ||
} | ||
], | ||
"Essential": true, | ||
"Image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest", | ||
"Memory": 512, | ||
"MemoryReservation": 32, | ||
"Name": "DomainJoinedContainer" | ||
}, | ||
{ | ||
"CredentialSpecs": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"credentialspecdomainless:", | ||
{ | ||
"Fn::GetAtt": [ | ||
"bucket43879C71", | ||
"Arn" | ||
] | ||
}, | ||
"/credSpecDomainless" | ||
] | ||
] | ||
} | ||
], | ||
"Essential": true, | ||
"Image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest", | ||
"Memory": 512, | ||
"MemoryReservation": 32, | ||
"Name": "DomainlessContainer" | ||
} | ||
], | ||
"ExecutionRoleArn": { | ||
"Fn::GetAtt": [ | ||
"taskexecutionrole7BB27090", | ||
"Arn" | ||
] | ||
}, | ||
"Family": "awsecstaskdefinitioncontainercredentialspecsTaskDefE15276BC", | ||
"NetworkMode": "bridge", | ||
"RequiresCompatibilities": [ | ||
"EC2" | ||
], | ||
"TaskRoleArn": { | ||
"Fn::GetAtt": [ | ||
"TaskDefTaskRole1EDB4A67", | ||
"Arn" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...teg/test/aws-ecs/test/integ.task-definition-container-credentialspecs.js.snapshot/cdk.out
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
.../test/aws-ecs/test/integ.task-definition-container-credentialspecs.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.