Skip to content

Commit

Permalink
fix: state machine 用の role を指定
Browse files Browse the repository at this point in the history
  • Loading branch information
morikiyo committed Apr 19, 2024
1 parent a24a5b4 commit 5d1c420
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/sg_fargate_rails/event_bridge_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def create_start_execution_state_machine(group_name:, state_machine_arn:)
schedule_expression_timezone: timezone,
target: {
arn: state_machine_arn,
input: input_overrides_json, # FIXME: このまま?
input: input_overrides_json,
retry_policy: {
maximum_event_age_in_seconds: 120,
maximum_retry_attempts: 2,
},
role_arn: role_arn_for(group_name, cluster_arn), # FIXME: IAM Role は同じものを利用できる?
role_arn: role_arn_for_state_machine(group_name, cluster_arn),
},
}
client.create_schedule(params)
Expand Down Expand Up @@ -111,6 +111,11 @@ def role_arn_for(group_name, cluster_arn)
"arn:aws:iam::#{account_id}:role/#{group_name}-eventbridge-scheduler-role"
end

def role_arn_for_state_machine(group_name, cluster_arn)
account_id = cluster_arn.split(':')[4]
"arn:aws:iam::#{account_id}:role/#{group_name}-step-functions-state-machine-role"
end

def client
self.class.client
end
Expand Down

0 comments on commit 5d1c420

Please sign in to comment.