Skip to content

Terraform for creating a simple ECS task for applications served on HTTP/HTTPS

Notifications You must be signed in to change notification settings

SummitResources/terraform-ecs-http-task

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECS HTTP Task

This module will allow you to deploy an ECS Task and an ECS Service. This is intended to be run as part of your app deployment pipeline. It works well with Concourse. It is assumed you already have a solution for deploying an ECS Cluster. If not, check out ours. This particular iteration assumes that you are deploying applications behind a load balancer with SSL termination and redirection from port 80 (i.e. AWS application load balancer).

Prerequisites

First, you need a decent understanding of how to use Terraform. Hit the docs for that. Then, you should familiarize yourself with ECS concepts, especially if you've never worked with a clustering solution before. Once you're good, import this module and pass the appropriate variables. Then, plan your run and deploy.

We also assume that you're deploying an application behind an ALB to port 443 (a really good idea). We will ask for your certificate ARN and automagically configure an HTTP to HTTPS redirect on the ALB. If you need more interesting features like opening ports other than 80 and 443 then feel free to use this as a template.

Example Usage

module "terraform-ecs-task" {
  source                = "git::https://github.com/7Factor/terraform-ecs-task.git"
  vpc_id                = "${data.aws_vpc.primary_vpc.id}"
  alb_subnets           = "${data.aws_subnet_ids.subnet_ids.ids}"
  lb_security_group_id  = "${data.aws_security_group.primary_sg.id}"
  app_name              = "${var.app_name}"
  app_port              = "${var.app_port}"
  cpu                   = "256"
  memory                = "256"
  desired_task_count    = "2"
  service_role_arn      = "${var.service_role_arn}"
  service_name          = "Angular Starter Service"
  container_definitions = "${data.template_file.container_definitions.rendered}"
}

About

Terraform for creating a simple ECS task for applications served on HTTP/HTTPS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 100.0%