Skip to content

Instantly share code, notes, and snippets.

@axelhodler
Created February 23, 2021 16:07
Show Gist options
  • Save axelhodler/491245ab19f5af10dbb5b27869c572f4 to your computer and use it in GitHub Desktop.
Save axelhodler/491245ab19f5af10dbb5b27869c572f4 to your computer and use it in GitHub Desktop.
Test containerdefinition image
test('Fargate is using the latest image in ECR', () => {
const app = new cdk.App();
const stack = new Cdktests.CdktestsStack(app, 'MyTestStack');
expectCDK(stack).to(haveResourceLike("AWS::ECS::TaskDefinition",{
ContainerDefinitions: [{
Image: {
"Fn::Join": [
"",
[
{
"Fn::Select": [
4,
{
"Fn::Split": [
":",
{
"Fn::GetAtt": [
"testrepository3CFC24EC",
"Arn"
]
}
]
}
]
},
".dkr.ecr.",
{
"Fn::Select": [
3,
{
"Fn::Split": [
":",
{
"Fn::GetAtt": [
"testrepository3CFC24EC",
"Arn"
]
}
]
}
]
},
".",
{
"Ref": "AWS::URLSuffix"
},
"/",
{
"Ref": "testrepository3CFC24EC"
},
":latest"
]
]
}
}]
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment