ecschedule
ecschedule copied to clipboard
A difference is detected even though the role has not been changed
Summary
It's always detected as a diff even though I haven't changed the role.
Steps to reproduce
$ cat ecschedule.yaml
region: ap-northeast-1
cluster: default
rules:
- name: hello-world
scheduleExpression: cron(0 0 1 * ? *)
taskDefinition: hello-world:1
role: service-role/AWS_Events_Invoke_Hello_World
launch_type: FARGATE
platform_version: LATEST
network_configuration:
aws_vpc_configuration:
subnets:
- subnet-04e6e052c7848b1f4
- subnet-0a707ad91535e027e
security_groups:
- sg-0ab440f589fd44d8e
assign_public_ip: DISABLED
propagateTags: TASK_DEFINITION
I confirmed that it is fixed by changing the code as follows.
diff --git rule_getter.go rule_getter.go
index 7491627..5a60d28 100644
--- rule_getter.go
+++ rule_getter.go
@@ -41,10 +41,7 @@ func (rg *ruleGetter) getRule(ctx context.Context, r *cloudwatchevents.Rule) (*R
return nil, nil
}
target := &Target{TargetID: targetID}
-
- if role := *t.RoleArn; role != rg.roleArn {
- target.Role = strings.TrimPrefix(role, rg.roleArnPrefix)
- }
+ target.Role = strings.TrimPrefix(*t.RoleArn, rg.roleArnPrefix)
taskCount := *ecsParams.TaskCount
if taskCount != 1 {
However, I don't know if I can remove this condition, so I reported it as an issue instead of a pull request.