terraform-aws-ecs icon indicating copy to clipboard operation
terraform-aws-ecs copied to clipboard

Support for scheduled tasks/standalone task definitions and container definitions

Open kaarejoergensen opened this issue 1 year ago β€’ 5 comments

Is your request related to a problem? Please describe.

I would like to be able to create scheduled tasks using this module, but I find it a bit cumbersome to create task definitions without creating a corresponding service. I would like to be able to use the EventBridge module in conjunction with this module.

Describe the solution you'd like.

I'd like to be able to create task definitions using this module, without creating a service. If the task definition could be moved to it's own sub-module, this module could be used.

Describe alternatives you've considered.

Right now I'm writing my own module by using the EventBridge module, and the aws_task_definition ressource.

Thank you in advance.

kaarejoergensen avatar Feb 08 '24 09:02 kaarejoergensen

Thanks for opening this issue. I think you can create aws_ecs_task_definition resources by controlling create_task_definition = true variables to turn on the creation only for task definition, while disabling the rest of the service-module resources if you use a submodule in modules/service:

https://github.com/terraform-aws-modules/terraform-aws-ecs/blob/master/modules/service/main.tf#L611

PS: I didn't try to do it. Just saying.

antonbabenko avatar Feb 09 '24 11:02 antonbabenko

If you want to disable service creation you need to set create = false and create_task_definition depends on var.create. Currently I don't see a way to create only task definition.

filip5114 avatar Feb 11 '24 11:02 filip5114

Hi guys! I stumbled upon the same problem now. Did you accomplish the goal with this module, or did you write your own module for such cases? @filip5114 @kaarejoergensen

lancedikson avatar Feb 23 '24 18:02 lancedikson

Own module. Basically, I have cloned this module and removed everything except task definition and container definitions.

filip5114 avatar Feb 24 '24 19:02 filip5114

Hi guys! I see @bryantbiggs tagged the issue as a v6 milestone target, though I needed to find a solution faster, so I introduced a simple separate switcher for the service resource, and this fix seems to be working for our case. @bryantbiggs do you think this is a fix we could consider for merging soon? I haven't checked the required PR-related checkpoints, such as testing the change over the examples, as I wanted to align with the maintainers on the applicability of the fix in general. Does this feature from your POV make sense?

lancedikson avatar Mar 03 '24 09:03 lancedikson

This issue has been resolved in version 5.10.0 :tada:

antonbabenko avatar Mar 12 '24 00:03 antonbabenko

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Apr 13 '24 01:04 github-actions[bot]