From f534e8a05e06566fe5e09b2b5bc86e0939af127d Mon Sep 17 00:00:00 2001 From: Joerg Woehrle Date: Fri, 7 Jun 2024 14:56:20 +0000 Subject: [PATCH 1/9] chore: Add wildcard revision to imported taskdefinition. Fixes #30390 --- .../aws-events-targets/lib/ecs-task.ts | 10 +- .../test/ecs/event-rule-target.test.ts | 98 +++++++++++++++++++ 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts index d17ef04e17e20..6498273a2007f 100644 --- a/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts @@ -277,10 +277,18 @@ export class EcsTask implements events.IRuleTarget { } private createEventRolePolicyStatements(): iam.PolicyStatement[] { + // check if there is a taskdefinition revision (arn will end with : followed by digits) included in the arn already + let needsRevisionWildcard = false; + if ( !cdk.Token.isUnresolved(this.taskDefinition.taskDefinitionArn)) { + const revisionAtEndPattern = /:[0-9]+$/; + const hasRevision = revisionAtEndPattern.test(this.taskDefinition.taskDefinitionArn); + needsRevisionWildcard = !hasRevision; + } + const policyStatements = [ new iam.PolicyStatement({ actions: ['ecs:RunTask'], - resources: [this.taskDefinition.taskDefinitionArn], + resources: [`${this.taskDefinition.taskDefinitionArn}${needsRevisionWildcard ? ':*' : ''}`], conditions: { ArnEquals: { 'ecs:cluster': this.cluster.clusterArn }, }, diff --git a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts index ebc88f0f91e9a..58e46eb29a219 100644 --- a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts +++ b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts @@ -9,6 +9,7 @@ import * as iam from '../../../aws-iam'; import * as sqs from '../../../aws-sqs'; import * as cdk from '../../../core'; import * as targets from '../../lib'; +import { EcsTask } from '../../lib'; let stack: cdk.Stack; let vpc: ec2.Vpc; @@ -1095,3 +1096,100 @@ test.each([ ], }); }); + +test('Non-imported TaskDefinition role is targeting by Ref', () => { + const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); + taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('henk'), + }); + + const rule = new events.Rule(stack, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.hours(1)), + }); + + rule.addTarget( + new EcsTask({ + cluster: cluster, + taskDefinition: taskDefinition, + }), + ); + + const policyMatch = Match.objectLike({ + PolicyDocument: { + Statement: Match.arrayWith([ + Match.objectLike({ + Action: 'ecs:RunTask', + Resource: { + Ref: 'TaskDef54694570', + }, + }), + ]), + }, + }); + const template = Template.fromStack(stack); + template.hasResource('AWS::IAM::Policy', { Properties: policyMatch }); +}); + +test('Imported task definition without revision adds wildcard to policy resource', () => { + const taskDefinition = ecs.FargateTaskDefinition.fromFargateTaskDefinitionAttributes(stack, 'TaskDefImport', { + taskDefinitionArn: 'arn:aws:ecs:us-west-2:012345678901:task-definition/MyTask', + taskRole: iam.Role.fromRoleArn(stack, 'RoleImport', 'arn:aws:iam::012345678901:role/MyTaskRole'), + networkMode: ecs.NetworkMode.AWS_VPC, + }); + + const rule = new events.Rule(stack, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.hours(1)), + }); + + rule.addTarget( + new EcsTask({ + cluster: cluster, + taskDefinition: taskDefinition, + }), + ); + + const policyMatch = Match.objectLike({ + PolicyDocument: { + Statement: Match.arrayWith([ + Match.objectLike({ + Action: 'ecs:RunTask', + Resource: `${taskDefinition.taskDefinitionArn}:*`, + }), + ]), + }, + }); + const template = Template.fromStack(stack); + template.hasResource('AWS::IAM::Policy', { Properties: policyMatch }); +}); + +test('Imported task definition with revision uses original arn for policy resource', () => { + const taskDefinition = ecs.FargateTaskDefinition.fromFargateTaskDefinitionAttributes(stack, 'TaskDefImport', { + taskDefinitionArn: 'arn:aws:ecs:us-west-2:012345678901:task-definition/MyTask:1', + taskRole: iam.Role.fromRoleArn(stack, 'RoleImport', 'arn:aws:iam::012345678901:role/MyTaskRole'), + networkMode: ecs.NetworkMode.AWS_VPC, + }); + + const rule = new events.Rule(stack, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.hours(1)), + }); + + rule.addTarget( + new EcsTask({ + cluster: cluster, + taskDefinition: taskDefinition, + }), + ); + + const policyMatch = Match.objectLike({ + PolicyDocument: { + Statement: Match.arrayWith([ + Match.objectLike({ + Action: 'ecs:RunTask', + Resource: taskDefinition.taskDefinitionArn, + }), + ]), + }, + }); + const template = Template.fromStack(stack); + template.hasResource('AWS::IAM::Policy', { Properties: policyMatch }); +}); \ No newline at end of file From 77ed4713c1afc12ad2ac7e360bc5375985a4d26f Mon Sep 17 00:00:00 2001 From: Joerg Woehrle Date: Mon, 17 Jun 2024 14:21:58 +0000 Subject: [PATCH 2/9] fix indent for linting --- .../test/ecs/event-rule-target.test.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts index 58e46eb29a219..d6a6c857e2914 100644 --- a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts +++ b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts @@ -1108,10 +1108,10 @@ test('Non-imported TaskDefinition role is targeting by Ref', () => { }); rule.addTarget( - new EcsTask({ - cluster: cluster, - taskDefinition: taskDefinition, - }), + new EcsTask({ + cluster: cluster, + taskDefinition: taskDefinition, + }), ); const policyMatch = Match.objectLike({ @@ -1142,10 +1142,10 @@ test('Imported task definition without revision adds wildcard to policy resource }); rule.addTarget( - new EcsTask({ - cluster: cluster, - taskDefinition: taskDefinition, - }), + new EcsTask({ + cluster: cluster, + taskDefinition: taskDefinition, + }), ); const policyMatch = Match.objectLike({ @@ -1174,10 +1174,10 @@ test('Imported task definition with revision uses original arn for policy resour }); rule.addTarget( - new EcsTask({ - cluster: cluster, - taskDefinition: taskDefinition, - }), + new EcsTask({ + cluster: cluster, + taskDefinition: taskDefinition, + }), ); const policyMatch = Match.objectLike({ From fc6abf7e5aeb6ccac7163f84b66cf8b38f945b96 Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Tue, 1 Oct 2024 15:02:43 -0700 Subject: [PATCH 3/9] integ test with imported task definition --- .../IntegEcsImportedTaskDefStack.assets.json | 32 + ...IntegEcsImportedTaskDefStack.template.json | 862 ++++++++++++ ...efaultTestDeployAssert69FA1335.assets.json | 19 + ...aultTestDeployAssert69FA1335.template.json | 36 + .../__entrypoint__.js | 155 +++ .../index.js | 1 + .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 311 +++++ .../tree.json | 1170 +++++++++++++++++ .../test/integ.ecs-imported-task-def.ts | 50 + 11 files changed, 2649 insertions(+) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json new file mode 100644 index 0000000000000..6d101cb1961e2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "36.0.0", + "files": { + "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1": { + "source": { + "path": "asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "c9c0323382d7bc414d6e0a3761ef850b2df6e1b2fe6b60da6cbe9eb682b14371": { + "source": { + "path": "IntegEcsImportedTaskDefStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "c9c0323382d7bc414d6e0a3761ef850b2df6e1b2fe6b60da6cbe9eb682b14371.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json new file mode 100644 index 0000000000000..72d1215a8beb7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json @@ -0,0 +1,862 @@ +{ + "Resources": { + "ClusterEB0386A7": { + "Type": "AWS::ECS::Cluster" + }, + "ClusterVpcFAA3CEDF": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc" + } + ] + } + }, + "ClusterVpcPublicSubnet1SubnetA9F7E0A5": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPublicSubnet1RouteTable5594A636": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPublicSubnet1RouteTableAssociation0FBEF1F4": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "ClusterVpcPublicSubnet1RouteTable5594A636" + }, + "SubnetId": { + "Ref": "ClusterVpcPublicSubnet1SubnetA9F7E0A5" + } + } + }, + "ClusterVpcPublicSubnet1DefaultRoute62DA4B4B": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "ClusterVpcIGW1E358A6E" + }, + "RouteTableId": { + "Ref": "ClusterVpcPublicSubnet1RouteTable5594A636" + } + }, + "DependsOn": [ + "ClusterVpcVPCGW47AC17E9" + ] + }, + "ClusterVpcPublicSubnet1EIP433C56EE": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ] + } + }, + "ClusterVpcPublicSubnet1NATGateway0693C346": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "ClusterVpcPublicSubnet1EIP433C56EE", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "ClusterVpcPublicSubnet1SubnetA9F7E0A5" + }, + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "ClusterVpcPublicSubnet1DefaultRoute62DA4B4B", + "ClusterVpcPublicSubnet1RouteTableAssociation0FBEF1F4" + ] + }, + "ClusterVpcPublicSubnet2Subnet059113C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPublicSubnet2RouteTable7B43F18C": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPublicSubnet2RouteTableAssociation8446B27D": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "ClusterVpcPublicSubnet2RouteTable7B43F18C" + }, + "SubnetId": { + "Ref": "ClusterVpcPublicSubnet2Subnet059113C4" + } + } + }, + "ClusterVpcPublicSubnet2DefaultRoute97446C8A": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "ClusterVpcIGW1E358A6E" + }, + "RouteTableId": { + "Ref": "ClusterVpcPublicSubnet2RouteTable7B43F18C" + } + }, + "DependsOn": [ + "ClusterVpcVPCGW47AC17E9" + ] + }, + "ClusterVpcPublicSubnet2EIP203DF3E5": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ] + } + }, + "ClusterVpcPublicSubnet2NATGateway00B24686": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "ClusterVpcPublicSubnet2EIP203DF3E5", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "ClusterVpcPublicSubnet2Subnet059113C4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "ClusterVpcPublicSubnet2DefaultRoute97446C8A", + "ClusterVpcPublicSubnet2RouteTableAssociation8446B27D" + ] + }, + "ClusterVpcPrivateSubnet1SubnetA4EB481A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPrivateSubnet1RouteTable5AAEDA3F": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPrivateSubnet1RouteTableAssociation9B8A88D9": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "ClusterVpcPrivateSubnet1RouteTable5AAEDA3F" + }, + "SubnetId": { + "Ref": "ClusterVpcPrivateSubnet1SubnetA4EB481A" + } + } + }, + "ClusterVpcPrivateSubnet1DefaultRoute3B4D40DD": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "ClusterVpcPublicSubnet1NATGateway0693C346" + }, + "RouteTableId": { + "Ref": "ClusterVpcPrivateSubnet1RouteTable5AAEDA3F" + } + } + }, + "ClusterVpcPrivateSubnet2SubnetBD1ECB6E": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPrivateSubnet2RouteTable73064A66": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcPrivateSubnet2RouteTableAssociationFB21349E": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "ClusterVpcPrivateSubnet2RouteTable73064A66" + }, + "SubnetId": { + "Ref": "ClusterVpcPrivateSubnet2SubnetBD1ECB6E" + } + } + }, + "ClusterVpcPrivateSubnet2DefaultRoute011666AF": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "ClusterVpcPublicSubnet2NATGateway00B24686" + }, + "RouteTableId": { + "Ref": "ClusterVpcPrivateSubnet2RouteTable73064A66" + } + } + }, + "ClusterVpcIGW1E358A6E": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "IntegEcsImportedTaskDefStack/Cluster/Vpc" + } + ] + } + }, + "ClusterVpcVPCGW47AC17E9": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "ClusterVpcIGW1E358A6E" + }, + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "ClusterVpcRestrictDefaultSecurityGroupCustomResourceA87DC6B5": { + "Type": "Custom::VpcRestrictDefaultSG", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", + "Arn" + ] + }, + "DefaultSecurityGroupId": { + "Fn::GetAtt": [ + "ClusterVpcFAA3CEDF", + "DefaultSecurityGroup" + ] + }, + "Account": { + "Ref": "AWS::AccountId" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:AuthorizeSecurityGroupIngress", + "ec2:AuthorizeSecurityGroupEgress", + "ec2:RevokeSecurityGroupIngress", + "ec2:RevokeSecurityGroupEgress" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":security-group/", + { + "Fn::GetAtt": [ + "ClusterVpcFAA3CEDF", + "DefaultSecurityGroup" + ] + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", + "Arn" + ] + }, + "Runtime": { + "Fn::FindInMap": [ + "LatestNodeRuntimeMap", + { + "Ref": "AWS::Region" + }, + "value" + ] + }, + "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" + }, + "DependsOn": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + ] + }, + "TaskRole30FC0FBB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "RoleName": "TaskRoleA" + } + }, + "TaskDef54694570": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "ContainerDefinitions": [ + { + "Essential": true, + "Image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest", + "Name": "web", + "PortMappings": [ + { + "ContainerPort": 12345, + "HostPort": 12345, + "Protocol": "tcp" + } + ] + } + ], + "Cpu": "1024", + "Family": "TaskDefinitionA", + "Memory": "2048", + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ], + "TaskRoleArn": { + "Fn::GetAtt": [ + "TaskRole30FC0FBB", + "Arn" + ] + } + } + }, + "TaskDefImportEventsRole9184C90E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "TaskDefImportEventsRoleDefaultPolicyA6BD21B8": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "ecs:RunTask", + "Condition": { + "ArnEquals": { + "ecs:cluster": { + "Fn::GetAtt": [ + "ClusterEB0386A7", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Resource": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef:*" + }, + { + "Action": "ecs:TagResource", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecs:", + { + "Ref": "AWS::Region" + }, + ":*:task/", + { + "Ref": "ClusterEB0386A7" + }, + "/*" + ] + ] + } + }, + { + "Action": "iam:PassRole", + "Effect": "Allow", + "Resource": "arn:aws:iam::123456789012:role/TaskRoleA" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "TaskDefImportEventsRoleDefaultPolicyA6BD21B8", + "Roles": [ + { + "Ref": "TaskDefImportEventsRole9184C90E" + } + ] + } + }, + "TaskDefImportSecurityGroup9D869A93": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "IntegEcsImportedTaskDefStack/TaskDefImport/SecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "Rule4C995B7F": { + "Type": "AWS::Events::Rule", + "Properties": { + "ScheduleExpression": "rate(1 day)", + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "ClusterEB0386A7", + "Arn" + ] + }, + "EcsParameters": { + "LaunchType": "FARGATE", + "NetworkConfiguration": { + "AwsVpcConfiguration": { + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "TaskDefImportSecurityGroup9D869A93", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "ClusterVpcPrivateSubnet1SubnetA4EB481A" + }, + { + "Ref": "ClusterVpcPrivateSubnet2SubnetBD1ECB6E" + } + ] + } + }, + "TaskCount": 1, + "TaskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef" + }, + "Id": "Target0", + "Input": "{}", + "RoleArn": { + "Fn::GetAtt": [ + "TaskDefImportEventsRole9184C90E", + "Arn" + ] + } + } + ] + }, + "DependsOn": [ + "TaskDef54694570" + ] + } + }, + "Mappings": { + "LatestNodeRuntimeMap": { + "af-south-1": { + "value": "nodejs20.x" + }, + "ap-east-1": { + "value": "nodejs20.x" + }, + "ap-northeast-1": { + "value": "nodejs20.x" + }, + "ap-northeast-2": { + "value": "nodejs20.x" + }, + "ap-northeast-3": { + "value": "nodejs20.x" + }, + "ap-south-1": { + "value": "nodejs20.x" + }, + "ap-south-2": { + "value": "nodejs20.x" + }, + "ap-southeast-1": { + "value": "nodejs20.x" + }, + "ap-southeast-2": { + "value": "nodejs20.x" + }, + "ap-southeast-3": { + "value": "nodejs20.x" + }, + "ap-southeast-4": { + "value": "nodejs20.x" + }, + "ca-central-1": { + "value": "nodejs20.x" + }, + "cn-north-1": { + "value": "nodejs18.x" + }, + "cn-northwest-1": { + "value": "nodejs18.x" + }, + "eu-central-1": { + "value": "nodejs20.x" + }, + "eu-central-2": { + "value": "nodejs20.x" + }, + "eu-north-1": { + "value": "nodejs20.x" + }, + "eu-south-1": { + "value": "nodejs20.x" + }, + "eu-south-2": { + "value": "nodejs20.x" + }, + "eu-west-1": { + "value": "nodejs20.x" + }, + "eu-west-2": { + "value": "nodejs20.x" + }, + "eu-west-3": { + "value": "nodejs20.x" + }, + "il-central-1": { + "value": "nodejs20.x" + }, + "me-central-1": { + "value": "nodejs20.x" + }, + "me-south-1": { + "value": "nodejs20.x" + }, + "sa-east-1": { + "value": "nodejs20.x" + }, + "us-east-1": { + "value": "nodejs20.x" + }, + "us-east-2": { + "value": "nodejs20.x" + }, + "us-gov-east-1": { + "value": "nodejs18.x" + }, + "us-gov-west-1": { + "value": "nodejs18.x" + }, + "us-iso-east-1": { + "value": "nodejs18.x" + }, + "us-iso-west-1": { + "value": "nodejs18.x" + }, + "us-isob-east-1": { + "value": "nodejs18.x" + }, + "us-west-1": { + "value": "nodejs20.x" + }, + "us-west-2": { + "value": "nodejs20.x" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "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." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json new file mode 100644 index 0000000000000..e85d264613bce --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "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." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js new file mode 100644 index 0000000000000..02033f55cf612 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + const parsedUrl = url.parse(event.ResponseURL); + const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; + exports.external.log('submit response to cloudformation', loggingSafeUrl, json); + const responseBody = JSON.stringify(json); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, requestBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, (response) => { + response.resume(); // Consume the response but don't care about it + if (!response.statusCode || response.statusCode >= 400) { + reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); + } + else { + resolve(); + } + }); + request.on('error', reject); + request.write(requestBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js new file mode 100644 index 0000000000000..013bcaffd8fe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js @@ -0,0 +1 @@ +"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json new file mode 100644 index 0000000000000..78185d1d1aa82 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "IntegTest-EcsImportedTaskDefinition/DefaultTest": { + "stacks": [ + "IntegEcsImportedTaskDefStack" + ], + "assertionStack": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert", + "assertionStackName": "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json new file mode 100644 index 0000000000000..4eea6b66c1aa6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json @@ -0,0 +1,311 @@ +{ + "version": "36.0.0", + "artifacts": { + "IntegEcsImportedTaskDefStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "IntegEcsImportedTaskDefStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "IntegEcsImportedTaskDefStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "IntegEcsImportedTaskDefStack.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c9c0323382d7bc414d6e0a3761ef850b2df6e1b2fe6b60da6cbe9eb682b14371.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "IntegEcsImportedTaskDefStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "IntegEcsImportedTaskDefStack.assets" + ], + "metadata": { + "/IntegEcsImportedTaskDefStack/Cluster/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterEB0386A7" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcFAA3CEDF" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet1SubnetA9F7E0A5" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet1RouteTable5594A636" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet1RouteTableAssociation0FBEF1F4" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet1DefaultRoute62DA4B4B" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet1EIP433C56EE" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet1NATGateway0693C346" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet2Subnet059113C4" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet2RouteTable7B43F18C" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet2RouteTableAssociation8446B27D" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet2DefaultRoute97446C8A" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet2EIP203DF3E5" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPublicSubnet2NATGateway00B24686" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet1SubnetA4EB481A" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet1RouteTable5AAEDA3F" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet1RouteTableAssociation9B8A88D9" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet1DefaultRoute3B4D40DD" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet2SubnetBD1ECB6E" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet2RouteTable73064A66" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet2RouteTableAssociationFB21349E" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcPrivateSubnet2DefaultRoute011666AF" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcIGW1E358A6E" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcVPCGW47AC17E9" + } + ], + "/IntegEcsImportedTaskDefStack/Cluster/Vpc/RestrictDefaultSecurityGroupCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterVpcRestrictDefaultSecurityGroupCustomResourceA87DC6B5" + } + ], + "/IntegEcsImportedTaskDefStack/LatestNodeRuntimeMap": [ + { + "type": "aws:cdk:logicalId", + "data": "LatestNodeRuntimeMap" + } + ], + "/IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + } + ], + "/IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" + } + ], + "/IntegEcsImportedTaskDefStack/TaskRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TaskRole30FC0FBB" + } + ], + "/IntegEcsImportedTaskDefStack/TaskDef/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TaskDef54694570" + } + ], + "/IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TaskDefImportEventsRole9184C90E" + } + ], + "/IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TaskDefImportEventsRoleDefaultPolicyA6BD21B8" + } + ], + "/IntegEcsImportedTaskDefStack/TaskDefImport/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TaskDefImportSecurityGroup9D869A93" + } + ], + "/IntegEcsImportedTaskDefStack/Rule/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Rule4C995B7F" + } + ], + "/IntegEcsImportedTaskDefStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/IntegEcsImportedTaskDefStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "IntegEcsImportedTaskDefStack" + }, + "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets" + ], + "metadata": { + "/IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json new file mode 100644 index 0000000000000..70bf2946dcda5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json @@ -0,0 +1,1170 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "IntegEcsImportedTaskDefStack": { + "id": "IntegEcsImportedTaskDefStack", + "path": "IntegEcsImportedTaskDefStack", + "children": { + "Cluster": { + "id": "Cluster", + "path": "IntegEcsImportedTaskDefStack/Cluster", + "children": { + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/Cluster/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Vpc": { + "id": "Vpc", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc", + "children": { + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Acl": { + "id": "Acl", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "ClusterVpcPublicSubnet1RouteTable5594A636" + }, + "subnetId": { + "Ref": "ClusterVpcPublicSubnet1SubnetA9F7E0A5" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "ClusterVpcIGW1E358A6E" + }, + "routeTableId": { + "Ref": "ClusterVpcPublicSubnet1RouteTable5594A636" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "EIP": { + "id": "EIP", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "ClusterVpcPublicSubnet1EIP433C56EE", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "ClusterVpcPublicSubnet1SubnetA9F7E0A5" + }, + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Acl": { + "id": "Acl", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "ClusterVpcPublicSubnet2RouteTable7B43F18C" + }, + "subnetId": { + "Ref": "ClusterVpcPublicSubnet2Subnet059113C4" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "ClusterVpcIGW1E358A6E" + }, + "routeTableId": { + "Ref": "ClusterVpcPublicSubnet2RouteTable7B43F18C" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "EIP": { + "id": "EIP", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "allocationId": { + "Fn::GetAtt": [ + "ClusterVpcPublicSubnet2EIP203DF3E5", + "AllocationId" + ] + }, + "subnetId": { + "Ref": "ClusterVpcPublicSubnet2Subnet059113C4" + }, + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Acl": { + "id": "Acl", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "ClusterVpcPrivateSubnet1RouteTable5AAEDA3F" + }, + "subnetId": { + "Ref": "ClusterVpcPrivateSubnet1SubnetA4EB481A" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "ClusterVpcPublicSubnet1NATGateway0693C346" + }, + "routeTableId": { + "Ref": "ClusterVpcPrivateSubnet1RouteTable5AAEDA3F" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Acl": { + "id": "Acl", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "ClusterVpcPrivateSubnet2RouteTable73064A66" + }, + "subnetId": { + "Ref": "ClusterVpcPrivateSubnet2SubnetBD1ECB6E" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "ClusterVpcPublicSubnet2NATGateway00B24686" + }, + "routeTableId": { + "Ref": "ClusterVpcPrivateSubnet2RouteTable73064A66" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "IntegEcsImportedTaskDefStack/Cluster/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "ClusterVpcIGW1E358A6E" + }, + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RestrictDefaultSecurityGroupCustomResource": { + "id": "RestrictDefaultSecurityGroupCustomResource", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/RestrictDefaultSecurityGroupCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "LatestNodeRuntimeMap": { + "id": "LatestNodeRuntimeMap", + "path": "IntegEcsImportedTaskDefStack/LatestNodeRuntimeMap", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Custom::VpcRestrictDefaultSGCustomResourceProvider": { + "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Role": { + "id": "Role", + "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Handler": { + "id": "Handler", + "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "TaskRole": { + "id": "TaskRole", + "path": "IntegEcsImportedTaskDefStack/TaskRole", + "children": { + "ImportTaskRole": { + "id": "ImportTaskRole", + "path": "IntegEcsImportedTaskDefStack/TaskRole/ImportTaskRole", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/TaskRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "roleName": "TaskRoleA" + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "TaskDef": { + "id": "TaskDef", + "path": "IntegEcsImportedTaskDefStack/TaskDef", + "children": { + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/TaskDef/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", + "aws:cdk:cloudformation:props": { + "containerDefinitions": [ + { + "essential": true, + "image": "public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest", + "name": "web", + "portMappings": [ + { + "containerPort": 12345, + "hostPort": 12345, + "protocol": "tcp" + } + ] + } + ], + "cpu": "1024", + "family": "TaskDefinitionA", + "memory": "2048", + "networkMode": "awsvpc", + "requiresCompatibilities": [ + "FARGATE" + ], + "taskRoleArn": { + "Fn::GetAtt": [ + "TaskRole30FC0FBB", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "web": { + "id": "web", + "path": "IntegEcsImportedTaskDefStack/TaskDef/web", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "RoleImport": { + "id": "RoleImport", + "path": "IntegEcsImportedTaskDefStack/RoleImport", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "TaskDefImport": { + "id": "TaskDefImport", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport", + "children": { + "EventsRole": { + "id": "EventsRole", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole", + "children": { + "ImportEventsRole": { + "id": "ImportEventsRole", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/ImportEventsRole", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "ecs:RunTask", + "Condition": { + "ArnEquals": { + "ecs:cluster": { + "Fn::GetAtt": [ + "ClusterEB0386A7", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Resource": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef:*" + }, + { + "Action": "ecs:TagResource", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecs:", + { + "Ref": "AWS::Region" + }, + ":*:task/", + { + "Ref": "ClusterEB0386A7" + }, + "/*" + ] + ] + } + }, + { + "Action": "iam:PassRole", + "Effect": "Allow", + "Resource": "arn:aws:iam::123456789012:role/TaskRoleA" + } + ], + "Version": "2012-10-17" + }, + "policyName": "TaskDefImportEventsRoleDefaultPolicyA6BD21B8", + "roles": [ + { + "Ref": "TaskDefImportEventsRole9184C90E" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/TaskDefImport/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "IntegEcsImportedTaskDefStack/TaskDefImport/SecurityGroup", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "ClusterVpcFAA3CEDF" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Rule": { + "id": "Rule", + "path": "IntegEcsImportedTaskDefStack/Rule", + "children": { + "Resource": { + "id": "Resource", + "path": "IntegEcsImportedTaskDefStack/Rule/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Events::Rule", + "aws:cdk:cloudformation:props": { + "scheduleExpression": "rate(1 day)", + "state": "ENABLED", + "targets": [ + { + "id": "Target0", + "arn": { + "Fn::GetAtt": [ + "ClusterEB0386A7", + "Arn" + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "TaskDefImportEventsRole9184C90E", + "Arn" + ] + }, + "ecsParameters": { + "taskCount": 1, + "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef", + "launchType": "FARGATE", + "networkConfiguration": { + "awsVpcConfiguration": { + "subnets": [ + { + "Ref": "ClusterVpcPrivateSubnet1SubnetA4EB481A" + }, + { + "Ref": "ClusterVpcPrivateSubnet2SubnetBD1ECB6E" + } + ], + "assignPublicIp": "DISABLED", + "securityGroups": [ + { + "Fn::GetAtt": [ + "TaskDefImportSecurityGroup9D869A93", + "GroupId" + ] + } + ] + } + } + }, + "input": "{}" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "IntegEcsImportedTaskDefStack/BootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "IntegEcsImportedTaskDefStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "IntegTest-EcsImportedTaskDefinition": { + "id": "IntegTest-EcsImportedTaskDefinition", + "path": "IntegTest-EcsImportedTaskDefinition", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts new file mode 100644 index 0000000000000..a6a8dc9d82610 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts @@ -0,0 +1,50 @@ +import { App, Duration, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Cluster, ContainerImage, FargateTaskDefinition, NetworkMode } from 'aws-cdk-lib/aws-ecs'; +import { Rule, Schedule } from 'aws-cdk-lib/aws-events'; +import { EcsTask } from 'aws-cdk-lib/aws-events-targets'; +import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; + +const account = process.env.CDK_INTEG_ACCOUNT || '123456789012'; +const region = process.env.CDK_INTEG_REGION || 'us-east-1'; + +const app = new App(); +const stack = new Stack(app, 'IntegEcsImportedTaskDefStack'); +const cluster = new Cluster(stack, 'Cluster'); +const taskDefFamily = 'TaskDefinitionA'; + +const taskRole = new Role(stack, 'TaskRole', { + roleName: 'TaskRoleA', + assumedBy: new ServicePrincipal('ecs-tasks.amazonaws.com'), +}); +const taskDefinition = new FargateTaskDefinition(stack, 'TaskDef', { + cpu: 1024, + memoryLimitMiB: 2048, + family: taskDefFamily, + taskRole: taskRole, +}); +taskDefinition.addContainer('web', { + image: ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), + portMappings: [ + { hostPort: 12345, containerPort: 12345 }, + ], +}); + +const importedTaskDef = FargateTaskDefinition.fromFargateTaskDefinitionAttributes(stack, 'TaskDefImport', { + taskDefinitionArn: `arn:aws:ecs:${region}:${account}:task-definition/TaskDef`, + taskRole: Role.fromRoleArn(stack, 'RoleImport', `arn:aws:iam::${account}:role/TaskRoleA`), + networkMode: NetworkMode.AWS_VPC, +}); + +const eventRule = new Rule(stack, 'Rule', { + targets: [new EcsTask({ + cluster, + taskDefinition: importedTaskDef, + })], + schedule: Schedule.rate(Duration.days(1)), +}); +eventRule.node.addDependency(taskDefinition); + +new IntegTest(app, 'IntegTest-EcsImportedTaskDefinition', { + testCases: [stack], +}); From e08c6439cf7ce4b84144f36619156c785283b1b0 Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Wed, 2 Oct 2024 11:15:37 -0700 Subject: [PATCH 4/9] Fix integ test snapshot account id and region --- .../IntegEcsImportedTaskDefStack.assets.json | 6 +- ...IntegEcsImportedTaskDefStack.template.json | 21 +- ...efaultTestDeployAssert69FA1335.assets.json | 2 +- .../cdk.out | 2 +- .../integ.json | 2 +- .../manifest.json | 12 +- .../tree.json | 246 +++++++++--------- .../test/integ.ecs-imported-task-def.ts | 8 +- 8 files changed, 163 insertions(+), 136 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json index 6d101cb1961e2..b07f9e1df28b9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1": { "source": { @@ -14,7 +14,7 @@ } } }, - "c9c0323382d7bc414d6e0a3761ef850b2df6e1b2fe6b60da6cbe9eb682b14371": { + "506b454ae8ddfd25a748f942e062ec48a970b96029d252db4e7b3f956e3ff430": { "source": { "path": "IntegEcsImportedTaskDefStack.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c9c0323382d7bc414d6e0a3761ef850b2df6e1b2fe6b60da6cbe9eb682b14371.json", + "objectKey": "506b454ae8ddfd25a748f942e062ec48a970b96029d252db4e7b3f956e3ff430.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json index 72d1215a8beb7..7c8cfcf30021a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json @@ -603,7 +603,7 @@ } }, "Effect": "Allow", - "Resource": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef:*" + "Resource": "arn:aws:ecs:test-region:12345678:task-definition/TaskDef:*" }, { "Action": "ecs:TagResource", @@ -632,7 +632,7 @@ { "Action": "iam:PassRole", "Effect": "Allow", - "Resource": "arn:aws:iam::123456789012:role/TaskRoleA" + "Resource": "arn:aws:iam::12345678:role/TaskRoleA" } ], "Version": "2012-10-17" @@ -698,7 +698,7 @@ } }, "TaskCount": 1, - "TaskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef" + "TaskDefinitionArn": "arn:aws:ecs:test-region:12345678:task-definition/TaskDef" }, "Id": "Target0", "Input": "{}", @@ -751,9 +751,18 @@ "ap-southeast-4": { "value": "nodejs20.x" }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, "ca-central-1": { "value": "nodejs20.x" }, + "ca-west-1": { + "value": "nodejs20.x" + }, "cn-north-1": { "value": "nodejs18.x" }, @@ -766,6 +775,9 @@ "eu-central-2": { "value": "nodejs20.x" }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, "eu-north-1": { "value": "nodejs20.x" }, @@ -793,6 +805,9 @@ "me-south-1": { "value": "nodejs20.x" }, + "mx-central-1": { + "value": "nodejs20.x" + }, "sa-east-1": { "value": "nodejs20.x" }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json index e85d264613bce..93ef7229a72cf 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out index 1f0068d32659a..c6e612584e352 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json index 78185d1d1aa82..ae2ef3ac3308a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "IntegTest-EcsImportedTaskDefinition/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json index 4eea6b66c1aa6..cde236149b0e2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "IntegEcsImportedTaskDefStack.assets": { "type": "cdk:asset-manifest", @@ -16,9 +16,10 @@ "templateFile": "IntegEcsImportedTaskDefStack.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c9c0323382d7bc414d6e0a3761ef850b2df6e1b2fe6b60da6cbe9eb682b14371.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/506b454ae8ddfd25a748f942e062ec48a970b96029d252db4e7b3f956e3ff430.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -190,6 +191,12 @@ "data": "LatestNodeRuntimeMap" } ], + "/IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider": [ + { + "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", + "data": true + } + ], "/IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ { "type": "aws:cdk:logicalId", @@ -268,6 +275,7 @@ "templateFile": "IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json index 70bf2946dcda5..dc915823c21cc 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json @@ -20,8 +20,8 @@ "aws:cdk:cloudformation:props": {} }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ecs.CfnCluster", + "version": "0.0.0" } }, "Vpc": { @@ -47,8 +47,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" } }, "PublicSubnet1": { @@ -91,16 +91,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -121,8 +121,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -140,8 +140,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -160,8 +160,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } }, "EIP": { @@ -180,8 +180,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" } }, "NATGateway": { @@ -208,8 +208,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" } } }, @@ -258,16 +258,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PublicSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -288,8 +288,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -307,8 +307,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -327,8 +327,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } }, "EIP": { @@ -347,8 +347,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" } }, "NATGateway": { @@ -375,8 +375,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" } } }, @@ -425,16 +425,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -455,8 +455,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -474,8 +474,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -494,8 +494,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } } }, @@ -544,16 +544,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/PrivateSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -574,8 +574,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -593,8 +593,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -613,8 +613,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } } }, @@ -638,8 +638,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" } }, "VPCGW": { @@ -657,8 +657,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" } }, "RestrictDefaultSecurityGroupCustomResource": { @@ -669,14 +669,14 @@ "id": "Default", "path": "IntegEcsImportedTaskDefStack/Cluster/Vpc/RestrictDefaultSecurityGroupCustomResource/Default", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" } } }, @@ -687,16 +687,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ecs.Cluster", + "version": "0.0.0" } }, "LatestNodeRuntimeMap": { "id": "LatestNodeRuntimeMap", "path": "IntegEcsImportedTaskDefStack/LatestNodeRuntimeMap", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnMapping", + "version": "0.0.0" } }, "Custom::VpcRestrictDefaultSGCustomResourceProvider": { @@ -707,30 +707,30 @@ "id": "Staging", "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" } }, "Role": { "id": "Role", "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" } }, "Handler": { "id": "Handler", "path": "IntegEcsImportedTaskDefStack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CustomResourceProviderBase", + "version": "0.0.0" } }, "TaskRole": { @@ -741,8 +741,8 @@ "id": "ImportTaskRole", "path": "IntegEcsImportedTaskDefStack/TaskRole/ImportTaskRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -767,14 +767,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" } }, "TaskDef": { @@ -817,30 +817,30 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ecs.CfnTaskDefinition", + "version": "0.0.0" } }, "web": { "id": "web", "path": "IntegEcsImportedTaskDefStack/TaskDef/web", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ecs.ContainerDefinition", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ecs.FargateTaskDefinition", + "version": "0.0.0" } }, "RoleImport": { "id": "RoleImport", "path": "IntegEcsImportedTaskDefStack/RoleImport", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "TaskDefImport": { @@ -855,8 +855,8 @@ "id": "ImportEventsRole", "path": "IntegEcsImportedTaskDefStack/TaskDefImport/EventsRole/ImportEventsRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -880,8 +880,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" } }, "DefaultPolicy": { @@ -909,7 +909,7 @@ } }, "Effect": "Allow", - "Resource": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef:*" + "Resource": "arn:aws:ecs:test-region:12345678:task-definition/TaskDef:*" }, { "Action": "ecs:TagResource", @@ -938,7 +938,7 @@ { "Action": "iam:PassRole", "Effect": "Allow", - "Resource": "arn:aws:iam::123456789012:role/TaskRoleA" + "Resource": "arn:aws:iam::12345678:role/TaskRoleA" } ], "Version": "2012-10-17" @@ -952,20 +952,20 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" } }, "SecurityGroup": { @@ -992,20 +992,20 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Rule": { @@ -1037,7 +1037,7 @@ }, "ecsParameters": { "taskCount": 1, - "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/TaskDef", + "taskDefinitionArn": "arn:aws:ecs:test-region:12345678:task-definition/TaskDef", "launchType": "FARGATE", "networkConfiguration": { "awsVpcConfiguration": { @@ -1067,36 +1067,36 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_events.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.aws_events.Rule", + "version": "0.0.0" } }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "IntegEcsImportedTaskDefStack/BootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "IntegEcsImportedTaskDefStack/CheckBootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" } }, "IntegTest-EcsImportedTaskDefinition": { @@ -1123,22 +1123,22 @@ "id": "BootstrapVersion", "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "IntegTest-EcsImportedTaskDefinition/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" } } }, @@ -1163,8 +1163,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts index a6a8dc9d82610..394e3234b45c3 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts @@ -5,8 +5,12 @@ import { Rule, Schedule } from 'aws-cdk-lib/aws-events'; import { EcsTask } from 'aws-cdk-lib/aws-events-targets'; import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; -const account = process.env.CDK_INTEG_ACCOUNT || '123456789012'; -const region = process.env.CDK_INTEG_REGION || 'us-east-1'; +/** + * To deploy the stack in this integ test, + * replace the account and region values with your AWS account and region to deploy to. + */ +const account = process.env.CDK_INTEG_ACCOUNT; +const region = process.env.CDK_INTEG_REGION; const app = new App(); const stack = new Stack(app, 'IntegEcsImportedTaskDefStack'); From 8b50888b0a465b8c0eef746d9f37cf721e79329f Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Fri, 4 Oct 2024 10:19:08 -0700 Subject: [PATCH 5/9] remove unnecessary whitespace Co-authored-by: Michael Sambol --- packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts index 6498273a2007f..87e5c3dd8a06c 100644 --- a/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts @@ -279,7 +279,7 @@ export class EcsTask implements events.IRuleTarget { private createEventRolePolicyStatements(): iam.PolicyStatement[] { // check if there is a taskdefinition revision (arn will end with : followed by digits) included in the arn already let needsRevisionWildcard = false; - if ( !cdk.Token.isUnresolved(this.taskDefinition.taskDefinitionArn)) { + if (!cdk.Token.isUnresolved(this.taskDefinition.taskDefinitionArn)) { const revisionAtEndPattern = /:[0-9]+$/; const hasRevision = revisionAtEndPattern.test(this.taskDefinition.taskDefinitionArn); needsRevisionWildcard = !hasRevision; From 6f3e56e0f1565b1c17a61b46dff83632b9bbe47f Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Fri, 4 Oct 2024 10:33:24 -0700 Subject: [PATCH 6/9] Spacing change Co-authored-by: Michael Sambol --- .../aws-events-targets/test/ecs/event-rule-target.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts index d6a6c857e2914..42b8bd9067c92 100644 --- a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts +++ b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts @@ -1192,4 +1192,4 @@ test('Imported task definition with revision uses original arn for policy resour }); const template = Template.fromStack(stack); template.hasResource('AWS::IAM::Policy', { Properties: policyMatch }); -}); \ No newline at end of file +}); From 4922d22b0c1b16497a38ae97b40aea46943f6c0d Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Fri, 4 Oct 2024 11:11:48 -0700 Subject: [PATCH 7/9] move integ test to the right dir --- .../IntegEcsImportedTaskDefStack.assets.json | 0 .../IntegEcsImportedTaskDefStack.template.json | 0 ...ortedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json | 0 ...tedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json | 0 .../__entrypoint__.js | 0 .../index.js | 0 .../test/ecs}/integ.ecs-imported-task-def.js.snapshot/cdk.out | 0 .../test/ecs}/integ.ecs-imported-task-def.js.snapshot/integ.json | 0 .../ecs}/integ.ecs-imported-task-def.js.snapshot/manifest.json | 0 .../test/ecs}/integ.ecs-imported-task-def.js.snapshot/tree.json | 0 .../test/ecs}/integ.ecs-imported-task-def.ts | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/cdk.out (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/integ.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/manifest.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.js.snapshot/tree.json (100%) rename packages/@aws-cdk-testing/framework-integ/test/{aws-events/test => aws-events-targets/test/ecs}/integ.ecs-imported-task-def.ts (100%) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.assets.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegEcsImportedTaskDefStack.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.assets.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/IntegTestEcsImportedTaskDefinitionDefaultTestDeployAssert69FA1335.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/cdk.out diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/integ.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/manifest.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.ts similarity index 100% rename from packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.ecs-imported-task-def.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.ecs-imported-task-def.ts From 5d25a9ca71cb8fc185c1e45cc00a37212eadf46c Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Fri, 4 Oct 2024 14:57:43 -0700 Subject: [PATCH 8/9] Update unit test name for better clarity --- .../aws-events-targets/test/ecs/event-rule-target.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts index 42b8bd9067c92..78e671aaf28ef 100644 --- a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts +++ b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts @@ -1097,7 +1097,7 @@ test.each([ }); }); -test('Non-imported TaskDefinition role is targeting by Ref', () => { +test('When using non-imported TaskDefinition, the IAM policy `Resource` should use `Ref` to reference the TaskDefinition, () => { const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); taskDefinition.addContainer('TheContainer', { image: ecs.ContainerImage.fromRegistry('henk'), From 239fdaab18450746cf7a479f7333bcbbcec69c59 Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Fri, 4 Oct 2024 15:37:40 -0700 Subject: [PATCH 9/9] Fixing missing quote --- .../aws-events-targets/test/ecs/event-rule-target.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts index 78e671aaf28ef..74f3b9024d70d 100644 --- a/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts +++ b/packages/aws-cdk-lib/aws-events-targets/test/ecs/event-rule-target.test.ts @@ -1097,7 +1097,7 @@ test.each([ }); }); -test('When using non-imported TaskDefinition, the IAM policy `Resource` should use `Ref` to reference the TaskDefinition, () => { +test('When using non-imported TaskDefinition, the IAM policy `Resource` should use `Ref` to reference the TaskDefinition', () => { const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); taskDefinition.addContainer('TheContainer', { image: ecs.ContainerImage.fromRegistry('henk'),