diff --git a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts index 3853764cb0828..060ea4e3f840e 100644 --- a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts +++ b/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts @@ -95,7 +95,7 @@ export class Ec2EventRuleTarget extends cdk.Construct implements events.IEventRu // // It never needs permissions to the Task Role. if (this.taskDefinition.executionRole !== undefined) { - this.taskDefinition.taskRole.grantPassRole(this.eventsRole); + this.taskDefinition.executionRole.grantPassRole(this.eventsRole); } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.event-task.lit.expected.json b/packages/@aws-cdk/aws-ecs/test/ec2/integ.event-task.lit.expected.json index 747bf88fc32ac..dff3047152599 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.event-task.lit.expected.json +++ b/packages/@aws-cdk/aws-ecs/test/ec2/integ.event-task.lit.expected.json @@ -491,8 +491,8 @@ "Action": "lambda:InvokeFunction", "FunctionName": { "Fn::GetAtt": [ - "EcsClusterDefaultAutoScalingGroupDrainECSHookFunctionE17A5F5E", - "Arn" + "EcsClusterDefaultAutoScalingGroupDrainECSHookFunctionE17A5F5E", + "Arn" ] }, "Principal": "sns.amazonaws.com", @@ -912,7 +912,7 @@ "Effect": "Allow", "Resource": { "Fn::GetAtt": [ - "TaskDefTaskRole1EDB4A67", + "TaskDefExecutionRoleB4775C97", "Arn" ] } @@ -1163,4 +1163,4 @@ "Description": "S3 key for asset version \"aws-ecs-integ-ecs/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/Code\"" } } -} +} \ No newline at end of file