Skip to content

ECS Services

Input map: service_definitions

Key points:

  • Fargate requires network_configuration.subnets.
  • For LB attachment, set load_balancer = [{ target_group_arn = "<vpc>.<target_group>", container_name, container_port }].
  • cluster and task_definition can be keyed names resolved in-module.

Example:

service_definitions = {
  smtp_forwarder = {
    name = "smtp_forwarder"
    cluster         = "SMTPCluster"
    task_definition = "SMTPTaskDefinition"
    desired_count   = 1
    launch_type     = "FARGATE"
    network_configuration = {
      subnets          = ["SharedInfra.SharedInfraPrivateAZ1"]
      security_groups  = ["SMTPSG"]
      assign_public_ip = false
    }
    load_balancer = [{
      target_group_arn = "SharedInfra.smtp_lb"
      container_name   = "smtp-forwarder"
      container_port   = 25
    }]
  }
}