Skip to content

Instantly share code, notes, and snippets.

@hendrixroa
Last active May 4, 2023 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendrixroa/cd25f398dc8d7a36060043d1d6665f3e to your computer and use it in GitHub Desktop.
Save hendrixroa/cd25f398dc8d7a36060043d1d6665f3e to your computer and use it in GitHub Desktop.
Module terraform definition to create a cron task launched by a cloudwatch scheduler event
module "noiselesstech_cron" {
source = "hendrixroa/cron-ecs-task/aws"
app = "noiselesstech"
# Compute resources
cpu_unit = 1024
memory = 2048
# Cron
event_rule = aws_cloudwatch_event_rule.cron_five_minutes.name
# Common inputs
execution_role_arn = aws_iam_role.ecs_task_execution.arn
repo_url = "${aws_ecr_repository.noiselesstech.repository_url}:latest"
ecs_cluster = aws_ecs_cluster.main.arn
ecs_event_role = aws_iam_role.ecs_events.arn
security_groups = [aws_security_group.sg.id]
subnets = module.vpc.public_subnets
environment_list = [
{
name = "blog"
value = "noiselesstech"
}
]
use_cloudwatch_logs = true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment