Skip to content

Latest commit

 

History

History
128 lines (109 loc) · 6.93 KB

README.md

File metadata and controls

128 lines (109 loc) · 6.93 KB

terraform-aws-ecs

Lint Status LICENSE

This module creates an ECS cluster

Usage

module "ecs_apps" {
  # source               = "git::https://github.com/DNXLabs/terraform-aws-ecs.git?ref=0.1.0"

  name                 = "${local.workspace["cluster_name"]}"
  instance_type_1      = "t3.large"
  instance_type_2      = "t2.large"
  instance_type_3      = "m2.xlarge"
  vpc_id               = "${data.aws_vpc.selected.id}"
  private_subnet_ids   = ["${data.aws_subnet_ids.private.ids}"]
  public_subnet_ids    = ["${data.aws_subnet_ids.public.ids}"]
  secure_subnet_ids    = ["${data.aws_subnet_ids.secure.ids}"]
  certificate_arn      = "${data.aws_acm_certificate.dnx_host.arn}"
  on_demand_percentage = 0
  asg_min              = 1
  asg_max              = 4
  asg_memory_target    = 50
}

Requirements

Name Version
terraform >= 0.12.20

Providers

Name Version
aws n/a
random n/a
template n/a

Inputs

Name Description Type Default Required
alarm_alb_400_errors_threshold Max threshold of HTTP 4000 errors allowed in a 5 minutes interval (use 0 to disable this alarm) number 10 no
alarm_alb_500_errors_threshold Max threshold of HTTP 500 errors allowed in a 5 minutes interval (use 0 to disable this alarm) number 10 no
alarm_alb_latency_anomaly_threshold ALB Latency anomaly detection width (use 0 to disable this alarm) number 2 no
alarm_asg_high_cpu_threshold Max threshold average CPU percentage allowed in a 2 minutes interval (use 0 to disable this alarm) number 80 no
alarm_ecs_high_cpu_threshold Max threshold average CPU percentage allowed in a 2 minutes interval (use 0 to disable this alarm) number 80 no
alarm_ecs_high_memory_threshold Max threshold average Memory percentage allowed in a 2 minutes interval (use 0 to disable this alarm) number 80 no
alarm_efs_credits_low_threshold Alerts when EFS credits fell below this number in bytes - default 1000000000000 is 1TB of a maximum of 2.31T of credits (use 0 to disable this alarm) number 1000000000000 no
alarm_sns_topics Alarm topics to create and alert on ECS instance metrics list [] no
alb Whether to deploy an ALB or not with the cluster bool true no
alb_internal Deploys a second internal ALB for private APIs bool false no
alb_only Whether to deploy only an alb and no cloudFront or not with the cluster bool false no
asg_max Max number of instances for autoscaling group number 4 no
asg_memory_target Target average memory percentage to track for autoscaling number 60 no
asg_min Min number of instances for autoscaling group number 1 no
autoscaling_default_cooldown The amount of time, in seconds, after a scaling activity completes before another scaling activity can start number 300 no
autoscaling_health_check_grace_period The length of time that Auto Scaling waits before checking an instance's health status. The grace period begins when an instance comes into service number 300 no
certificate_arn n/a any n/a yes
enable_schedule Enables schedule to shut down and start up instances outside business hours bool false no
environment_linux linux image for ECS bool true no
environment_windows Windows image for ECS bool false no
expire_backup_efs Number of days the backup will be expired number 0 no
instance_type_1 Instance type for ECS workers (first priority) any n/a yes
instance_type_2 Instance type for ECS workers (second priority) any n/a yes
instance_type_3 Instance type for ECS workers (third priority) any n/a yes
instance_volume_size Volume size for docker volume (in GB) number 22 no
instance_volume_size_root Volume size for root volume (in GB) number 16 no
lb_access_logs_bucket Bucket to store logs from lb access string "" no
lb_access_logs_prefix Bucket prefix to store lb access logs string "" no
name Name of this ECS cluster any n/a yes
on_demand_base_capacity You can designate a base portion of your total capacity as On-Demand. As the group scales, per your settings, the base portion is provisioned first, while additional On-Demand capacity is percentage-based. number 0 no
on_demand_percentage Percentage of on-demand intances vs spot number 100 no
private_subnet_ids List of private subnet IDs for ECS instances and Internal ALB when enabled list(string) n/a yes
public_subnet_ids List of public subnet IDs for ECS ALB list(string) n/a yes
schedule_cron_start Cron expression to define when to trigger a start of the auto-scaling group. E.g. '0 20 * * *' to start at 8pm GMT time string "" no
schedule_cron_stop Cron expression to define when to trigger a stop of the auto-scaling group. E.g. '0 10 * * *' to stop at 10am GMT time string "" no
secure_subnet_ids List of secure subnet IDs for EFS list(string) n/a yes
security_group_ids Extra security groups for instances list(string) [] no
target_group_arns List of target groups for ASG to register list(string) [] no
userdata Extra commands to pass to userdata string "" no
vpc_id VPC ID to deploy the ECS cluster any n/a yes

Outputs

Name Description
alb_arn n/a
alb_cloudfront_key n/a
alb_dns_name n/a
alb_id n/a
alb_internal_arn n/a
alb_internal_dns_name n/a
alb_internal_id n/a
alb_internal_listener_https_arn n/a
alb_internal_listener_test_traffic_arn n/a
alb_internal_zone_id n/a
alb_listener_https_arn n/a
alb_listener_test_traffic_arn n/a
alb_secgrp_id n/a
alb_zone_id n/a
ecs_arn n/a
ecs_iam_role_arn n/a
ecs_iam_role_name n/a
ecs_id n/a
ecs_name n/a
ecs_nodes_secgrp_id n/a
ecs_service_iam_role_arn n/a
ecs_service_iam_role_name n/a
ecs_task_iam_role_arn n/a
ecs_task_iam_role_name n/a

Authors

Module managed by DNX Solutions.

License

Apache 2 Licensed. See LICENSE for full details.