/tf_aws_ecs

Terraform module which creates AWS ECS resources

Primary LanguageHCLMIT LicenseMIT

ecs terraform module

A terraform module to provide ECS clusters in AWS.

Module Input Variables

Required

  • name - ECS cluster name
  • key_name - An EC2 key pair name
  • subnet_id - A list of subnet IDs
  • vpc_id - The VPC ID to place the cluster in

Optional

extra_tags = [
    {
      key                 = "consul_server"
      value               = "true"
      propagate_at_launch = true
    },
  ]
  • allowed_cidr_blocks - List of subnets to allow into the ECS Security Group. Defaults to ["0.0.0.0/0"].
  • ami - A specific AMI image to use, eg ami-95f8d2f3. Defaults to the latest ECS optimized Amazon Linux AMI.
  • ami_version - Specific version of the Amazon ECS AMI to use (e.g. 2016.09). Defaults to *. Ignored if ami is specified.
  • heartbeat_timeout - Heartbeat Timeout setting for how long it takes for the graceful shutodwn hook takes to timeout. This is useful when deploying clustered applications like consul that benifit from having a deploy between autoscaling create/destroy actions. Defaults to 180"
  • security_group_ids - a list of security group IDs to apply to the launch configuration
  • user_data - The instance user data (e.g. a cloud-init config) to use in the aws_launch_configuration

Usage

module "ecs-cluster" {
  source    = "github.com/terraform-community-modules/tf_aws_ecs"
  name      = "infra-services"
  servers   = 1
  subnet_id = ["subnet-6e101446"]
  vpc_id    = "vpc-99e73dfc"
  key_name  = "key.pem"
}

Outputs

  • cluster_id - (String) ECS Cluster id for use in ECS task and service definitions.
  • autoscaling_group (Map) A map with keys id, name, and arn of the aws_autoscaling_group created.

Authors

License

MIT