Open alexzum opened 11 months ago
Voting for Prioritization
Volunteering to Work on This Issue
I found this issue while trying to add ECS container overrides to a new schedule. However, I found that setting the target.input
variable was enough for the overrides to be populated:
resource "aws_scheduler_schedule" "this" {
target {
ecs_parameters {
# ...
}
input = jsonencode({
containerOverrides = [
{
name = "app"
command = ["..."]
}
]
})
}
}
@adamantike Hello ,
That is to say that instead of ecs_parameters we can use only the input? because I have tried to use ecs_parameters and I am getting this error:
Error: updating Amazon EventBridge Scheduler Schedule (default/-scale-in-core-scheduler): operation error Scheduler: UpdateSchedule, https response error StatusCode: 400, RequestID: b6ef4cea-d9af-4f7a- b460-409690a605f3, ValidationException: Parameters EcsParameters not supported for the target.
@rocker1058, this is a more detailed example, in case that helps you. I use both ecs_parameters
and input
, not one instead of the other.
resource "aws_scheduler_schedule" "this" {
name = "test"
state = "ENABLED"
schedule_expression = "cron(0 0 * * ? *)"
flexible_time_window {
mode = "OFF"
}
target {
arn = "arn:..." # ECS cluster ARN
# role_arn is the ARN for a role with permissions specified here:
# https://docs.aws.amazon.com/scheduler/latest/UserGuide/setting-up.html#setting-up-execution-role
role_arn = "arn:..."
input = jsonencode({
containerOverrides = [
{ name = "...", command = ["..."] }
]
})
ecs_parameters {
task_definition_arn = "arn:..." # ARN of the ECS Task Definition to trigger
launch_type = "FARGATE"
network_configuration {
subnets = ["..."]
security_groups = ["..."]
}
}
retry_policy {
maximum_retry_attempts = 3
}
}
}
Description
Please enhance the ecs_parameters to allow a resource to pass overrides. See the
overrides
input parameter in the ECS RunTask API documentation.aws_scheduler_schedule supports running ecs tasks on a scheduler controlled by eventbridge scheduler.
The workaround for this omission is to switch over to the eventbridge scheduler schedule universal target which is freeform. A caller can provide overrides with it. The universal target is more complicated and the aws terraform provider supports the ecs_task already. It's just missing one field, overrides.
Affected Resource(s) and/or Data Source(s)
Potential Terraform Configuration
References
Would you like to implement a fix?
None