From acd2de184f3b4897988ca81a7c998cc9a4a6960e Mon Sep 17 00:00:00 2001 From: Hsing-Hui Hsu Date: Tue, 2 Apr 2019 12:35:43 -0700 Subject: [PATCH] fix(aws-ecs): use executionRole for event rule target Fixes #2015. --- .../@aws-cdk/aws-ecs/lib/ec2/ec2-event-rule-target.ts | 4 ++-- .../aws-ecs/test/ec2/integ.event-task.lit.expected.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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