Terraform-provider-aws: [ECS] Support for Scheduled Tasks (cron) ECS Tasks

Created on 15 Jun 2017  ·  10Comments  ·  Source: hashicorp/terraform-provider-aws

Hi,

Amazon recently announced the introduction of Scheduled ECS Tasks - which we would find very useful and prevent us from having to jump through hoops to get scheduled tasks to run on ECS

It would be awesome to be able to start creating these and managing them through Terraform. Sorry if this is a duplicate issue and thank you!

enhancement

Most helpful comment

So Amazon have just announced and released Amazon ECS Adds Daemon Scheduling. Please could we have support for this attribute in Terraform?

All 10 comments

Hi @gregeinfrank
I believe that the AWS Console UI steps mentioned in the dev guide are just covering existing API functionality which Terraform already supports. Specifically CloudWatch Events.

Have looked at https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_target.html and other relevant resources? As far as I can see there's no new ECS API for "scheduled tasks". All you seem to need is ECS Task Definition + ECS cluster and CloudWatch Event Rule + CloudWatch Event Target + relevant IAM resources.

@radeksimko I must have missed that - I will look into cloudwatch_event_target and see if I can schedule ECS tasks from there. Thanks

@radeksimko @gregeinfrank
I tried this today, and it looks like there's a new set of EcsParameters options that are required in order for your target to run an ECS task.
It needs to pass in the ECS cluster ARN for the regular Arn parameter, but there's a separate TaskDefinitionArn and TaskCount that need to be provided in EcsParameters to tell it what to run on that cluster.

Looking at the source and documentation, it doesn't look like the resource can send these in its current state.
It looks like it'd be really similar to how the run_command_targets argument works now.

JSON Syntax example in the AWS CLI docs: http://docs.aws.amazon.com/cli/latest/reference/events/put-targets.html

related: #871

@anthonyagresta You're right, thanks for the effort in figuring out what's missing 👍

Re-labelling as enhancement. PRs welcomed 😉

https://github.com/terraform-providers/terraform-provider-aws/pull/977 was merged and will be part of the next release.

@anthonyagresta I was struggling with the exact same thing (albeit in Ansible, not terraform), and your comment here helped me figure things out.

Big cheers for that!

So Amazon have just announced and released Amazon ECS Adds Daemon Scheduling. Please could we have support for this attribute in Terraform?

@joshuamkite Sounds like that should be an entirely separate issue.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings