Skip to content

Instantly share code, notes, and snippets.

@vthub
Created January 4, 2020 00:31
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 vthub/4e2da1575fe1375d4dd0928167f08024 to your computer and use it in GitHub Desktop.
Save vthub/4e2da1575fe1375d4dd0928167f08024 to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_event_target" "scheduled_task" {
target_id = "$scheduled-ecs-target"
rule = aws_cloudwatch_event_rule.scheduled_task.name
arn = aws_ecs_cluster.cluster.arn
role_arn = aws_iam_role.scheduled_task_cloudwatch.arn
ecs_target {
task_count = 1
task_definition_arn = aws_ecs_task_definition.definition.arn
launch_type = "FARGATE"
network_configuration {
subnets = data.aws_subnet_ids.subnets.ids
assign_public_ip = true
security_groups = [aws_security_group.ecs.id]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment