Skip to content

Commit 39904b5

Browse files
committed
feat: Add support for EventBridge Schedule mode
1 parent dbc4b92 commit 39904b5

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

examples/schedule/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module "cloud_custodian_lambda" {
122122
execution_options = {
123123
# Not really required but if you run custodian run you need to specify -s/--output-dir you'd then have execution-options
124124
# as part of the config.json with the output_dir that was specified
125-
"output_dir" = "s3://${local.prefix}periodic-${local.account_id}/output?region=${local.region}"
125+
"output_dir" = "s3://${local.prefix}schedule-${local.account_id}/output?region=${local.region}"
126126
}
127127

128128
policies = templatefile("${path.module}/templates/policy.yaml.tpl", {

main.tf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,8 @@ resource "aws_scheduler_schedule" "schedule" {
204204
end_date = local.schedule_end_date
205205

206206
target {
207-
arn = aws_lambda_function.custodian[each.key].arn
207+
arn = aws_lambda_function.custodian[each.key].qualified_arn
208208
role_arn = local.schedule_scheduler_role
209-
210-
retry_policy {
211-
maximum_retry_attempts = 0
212-
}
213209
}
214210

215211
lifecycle {

ops/package_lambda_policy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ def add_handler_and_config_to_archive(archive, policy_list, exec_options):
6363
Returns:
6464
PythonPackageArchive: Archive with handler and config added
6565
"""
66-
try:
67-
archive.add_contents("custodian_policy.py", PolicyHandlerTemplate)
68-
except AssertionError as e:
69-
raise RuntimeError(f"Failed to add handler template: {e}")
70-
7166
try:
7267
config_data = {
7368
"execution-options": exec_options,
@@ -77,6 +72,11 @@ def add_handler_and_config_to_archive(archive, policy_list, exec_options):
7772
except AssertionError as e:
7873
raise RuntimeError(f"Failed to add config.json: {e}")
7974

75+
try:
76+
archive.add_contents("custodian_policy.py", PolicyHandlerTemplate)
77+
except AssertionError as e:
78+
raise RuntimeError(f"Failed to add handler template: {e}")
79+
8080
return archive
8181

8282

0 commit comments

Comments
 (0)