Skip to content

Instantly share code, notes, and snippets.

@osterman

osterman/ecs-tasks.tf Secret

Created Sep 24, 2018
Embed
What would you like to do?
# default backend app
module "default_backend_web_app" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-web-app.git?ref=tags/0.8.0"
name = "backend"
namespace = "${var.namespace}"
stage = "${var.stage}"
vpc_id = "${module.vpc.vpc_id}"
container_image = "${var.default_container_image}"
container_cpu = "256"
container_memory = "512"
container_port = "80"
#launch_type = "FARGATE"
listener_arns = "${module.alb.listener_arns}"
listener_arns_count = "1"
aws_logs_region = "${var.region}"
ecs_cluster_arn = "${aws_ecs_cluster.default.arn}"
ecs_cluster_name = "${aws_ecs_cluster.default.name}"
ecs_security_group_ids = ["${module.vpc.vpc_default_security_group_id}"]
ecs_private_subnet_ids = ["${module.subnets.private_subnet_ids}"]
alb_ingress_healthcheck_path = "/healthz"
alb_ingress_paths = ["/*"]
codepipeline_enabled = "false"
ecs_alarms_enabled = "true"
autoscaling_enabled = "false"
alb_name = "${module.alb.alb_name}"
alb_arn_suffix = "${module.alb.alb_arn_suffix}"
alb_target_group_alarms_enabled = "true"
alb_target_group_alarms_3xx_threshold = "25"
alb_target_group_alarms_4xx_threshold = "25"
alb_target_group_alarms_5xx_threshold = "25"
alb_target_group_alarms_response_time_threshold = "0.5"
alb_target_group_alarms_period = "300"
alb_target_group_alarms_evaluation_periods = "1"
}
# web app
module "example_web_app" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-web-app.git?ref=tags/0.8.0"
name = "example"
namespace = "${var.namespace}"
stage = "${var.stage}"
vpc_id = "${module.vpc.vpc_id}"
container_image = "${var.default_container_image}"
container_cpu = "4096"
container_memory = "8192"
#container_memory_reservation = ""
container_port = "80"
desired_count = "5"
autoscaling_enabled = "true"
autoscaling_dimension = "cpu"
autoscaling_min_capacity = "2"
autoscaling_max_capacity = "15"
autoscaling_scale_up_adjustment = "1"
autoscaling_scale_up_cooldown = "60"
autoscaling_scale_down_adjustment = "-1"
autoscaling_scale_down_cooldown = "300"
#launch_type = "FARGATE"
listener_arns = "${module.alb.listener_arns}"
listener_arns_count = "1"
aws_logs_region = "${var.region}"
ecs_cluster_arn = "${aws_ecs_cluster.default.arn}"
ecs_cluster_name = "${aws_ecs_cluster.default.name}"
ecs_security_group_ids = ["${module.vpc.vpc_default_security_group_id}"]
ecs_private_subnet_ids = ["${module.subnets.private_subnet_ids}"]
alb_ingress_healthcheck_path = "/"
alb_ingress_paths = ["/*"]
alb_ingress_listener_priority = "100"
codepipeline_enabled = "true"
github_oauth_token = "${var.GITHUB_OAUTH_TOKEN}"
repo_owner = "cloudposse"
repo_name = "example"
branch = "master"
ecs_alarms_enabled = "true"
# ecs_alarms_cpu_utilization_low_threshold = "20"
# ecs_alarms_cpu_utilization_low_evaluation_periods = "1"
# ecs_alarms_cpu_utilization_low_period = "300"
# ecs_alarms_cpu_utilization_low_alarm_actions = []
# ecs_alarms_cpu_utilization_low_ok_actions = []
# ecs_alarms_cpu_utilization_high_threshold = "80"
# ecs_alarms_cpu_utilization_high_evaluation_periods = "1"
# ecs_alarms_cpu_utilization_high_period = "300"
# ecs_alarms_cpu_utilization_high_alarm_actions = []
# ecs_alarms_cpu_utilization_high_ok_actions = []
# ecs_alarms_memory_utilization_low_threshold = "20"
# ecs_alarms_memory_utilization_low_evaluation_periods = "1"
# ecs_alarms_memory_utilization_low_period = "300"
# ecs_alarms_memory_utilization_low_alarm_actions = []
# ecs_alarms_memory_utilization_low_ok_actions = []
# ecs_alarms_memory_utilization_high_threshold = "80"
# ecs_alarms_memory_utilization_high_evaluation_periods = "1"
# ecs_alarms_memory_utilization_high_period = "300"
# ecs_alarms_memory_utilization_high_alarm_actions = []
# ecs_alarms_memory_utilization_high_ok_actions = []
alb_target_group_alarms_enabled = "true"
alb_target_group_alarms_3xx_threshold = "25"
alb_target_group_alarms_4xx_threshold = "25"
alb_target_group_alarms_5xx_threshold = "25"
alb_target_group_alarms_response_time_threshold = "0.5"
alb_target_group_alarms_period = "300"
alb_target_group_alarms_evaluation_periods = "1"
alb_name = "${module.alb.alb_name}"
alb_arn_suffix = "${module.alb.alb_arn_suffix}"
#alb_target_group_alarms_alarm_actions = []
#alb_target_group_alarms_ok_actions = []
#alb_target_group_alarms_insufficient_data_actions = []
}
@osterman

This comment has been minimized.

Copy link
Owner Author

@osterman osterman commented Sep 24, 2018

variable "default_cert_arn" {
  type        = "string"
  description = "ARN of the default cert to add to HTTPS ingress on ALB"
}


variable "ingress_cidr_blocks_http" {
  type        = "list"
  default     = ["0.0.0.0/0"]
  description = "List of CIDR blocks allowed to access environment over HTTP"
}

variable "ingress_cidr_blocks_https" {
  type        = "list"
  default     = ["0.0.0.0/0"]
  description = "List of CIDR blocks allowed to access environment over HTTPS"
}


module "alb" {
  source             = "git::https://github.com/cloudposse/terraform-aws-alb.git?ref=tags/0.2.5"
  name               = "cluster"
  namespace          = "${var.namespace}"
  stage              = "${var.stage}"
  attributes         = "${var.attributes}"
  vpc_id             = "${module.vpc.vpc_id}"
  ip_address_type    = "ipv4"
  subnet_ids         = ["${module.subnets.public_subnet_ids}"]
  security_group_ids = ["${module.vpc.vpc_default_security_group_id}"]
  access_logs_region = "${var.region}"

  https_enabled = "true"
  http_ingress_cidr_blocks = "${var.ingress_cidr_blocks_http}"
  https_ingress_cidr_blocks = "${var.ingress_cidr_blocks_https}"
  certificate_arn    = "${var.default_cert_arn}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment