Skip to content

Commit a72f6f3

Browse files
refactor: improve readiblity of scheduled event iam role code
1 parent 5bd5f56 commit a72f6f3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/deploy/events/schedule/compileScheduledEvents.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ module.exports = {
8282
const scheduleId = this.getScheduleId(stateMachineName);
8383
const policyName = this.getSchedulePolicyName(stateMachineName);
8484

85+
const roleArn = event.schedule.role ?
86+
JSON.stringify(event.schedule.role) :
87+
`
88+
{
89+
"Fn::GetAtt": [
90+
"${scheduleIamRoleLogicalId}",
91+
"Arn"
92+
]
93+
}
94+
`;
95+
8596
const scheduleTemplate = `
8697
{
8798
"Type": "AWS::Events::Rule",
@@ -95,18 +106,7 @@ module.exports = {
95106
${InputPath ? `"InputPath": "${InputPath}",` : ''}
96107
"Arn": { "Ref": "${stateMachineLogicalId}" },
97108
"Id": "${scheduleId}",
98-
"RoleArn": ${
99-
event.schedule.role ?
100-
JSON.stringify(event.schedule.role) :
101-
`
102-
{
103-
"Fn::GetAtt": [
104-
"${scheduleIamRoleLogicalId}",
105-
"Arn"
106-
]
107-
}
108-
`
109-
}
109+
"RoleArn": ${roleArn}
110110
}]
111111
}
112112
}

0 commit comments

Comments
 (0)