Skip to content

Instantly share code, notes, and snippets.

@hendrixroa
Last active May 4, 2023 16:33
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/94493c5d4e219045fb554723cda2715a to your computer and use it in GitHub Desktop.
Save hendrixroa/94493c5d4e219045fb554723cda2715a to your computer and use it in GitHub Desktop.
AWS Clouwatch event to perform an ECS Task
resource "aws_cloudwatch_event_target" "main" {
target_id = "${var.app}-target"
arn = var.ecs_cluster
rule = var.event_rule
role_arn = var.ecs_event_role
ecs_target {
task_count = 1
task_definition_arn = aws_ecs_task_definition.main.arn
launch_type = "FARGATE"
platform_version = "LATEST"
network_configuration {
security_groups = var.security_groups
subnets = var.subnets
assign_public_ip = var.public_ip
}
}
depends_on = [
aws_ecs_task_definition.main
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment