ecs terraform module
A terraform module to provide ECS clusters in AWS.
Module Input Variables
Required
name
- ECS cluster namekey_name
- An EC2 key pair namesubnet_id
- A list of subnet IDsvpc_id
- The VPC ID to place the cluster in
Optional
region
- AWS Region - defaults to us-east-1servers
- Number of ECS Servers to start in the cluster - defaults to 2instance_type
- AWS instance type - defaults to t2.microassociate_public_ip_address
- assign a publicly-routable IP address to every instance in the cluster - default:false
.docker_storage_size
- EBS Volume size in Gib that the ECS Instance uses for Docker images and metadata - defaults to 22dockerhub_email
- Email Address used to authenticate to dockerhub. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.htmldockerhub_token
- Auth Token used for dockerhub. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.htmlextra_tags
- Additional tags to be added to the ECS autoscaling group. Must be in the form of an array of hashes. See https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html for examples.
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, egami-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 ifami
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 configurationuser_data
- The instance user data (e.g. acloud-init
config) to use in theaws_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 keysid
,name
, andarn
of theaws_autoscaling_group
created.