diff --git a/_alb.tf b/_alb.tf index ac9cb8f..ac3db42 100644 --- a/_alb.tf +++ b/_alb.tf @@ -14,6 +14,14 @@ resource "aws_lb_target_group" "lb_target" { port = 80 protocol = "HTTP" vpc_id = "${aws_vpc.vpc.id}" + + health_check = { + interval = 6 + timeout = 5 + path = "${var.health-check-path}" + port = "${var.health-check-port}" + matcher = "200-299" + } } resource "aws_lb_listener" "lb_listener" { diff --git a/_sg.tf b/_sg.tf index c0cfc14..6a3dc62 100644 --- a/_sg.tf +++ b/_sg.tf @@ -11,16 +11,16 @@ resource "aws_security_group" "sg" { } ingress { - protocol = "tcp" - from_port = "80" - to_port = "80" + protocol = "tcp" + from_port = "80" + to_port = "80" security_groups = ["${aws_security_group.sg_alb.id}"] } ingress { - protocol = "tcp" - from_port = "443" - to_port = "443" + protocol = "tcp" + from_port = "443" + to_port = "443" security_groups = ["${aws_security_group.sg_alb.id}"] } diff --git a/_variables.tf b/_variables.tf index 57da2d8..ece68d4 100644 --- a/_variables.tf +++ b/_variables.tf @@ -168,4 +168,16 @@ variable "ssh-allowed-ips" { description = "The list of IPs that are allowed to SSH into the instances" type = "list" default = [] -} \ No newline at end of file +} + +variable "health-check-path" { + description = "The apps public sub domain name" + type = "string" + default = "/" +} + +variable "health-check-port" { + description = "The apps public sub domain name" + type = "string" + default = "80" +} diff --git a/examples/engagement-app/main.tf b/examples/engagement-app/main.tf index 8b33bd3..73e416f 100644 --- a/examples/engagement-app/main.tf +++ b/examples/engagement-app/main.tf @@ -1,11 +1,11 @@ module "asg" { - source = "../../" + source = "../../" aws-profile = "ds-web-products-staging" - aws-region = "eu-west-3" - instance-ami = "ami-0dd7e7ed60da8fb83" - user-data-script = "./user-data.sh" - asg-min-size = "2" + aws-region = "eu-west-3" + instance-ami = "ami-0dd7e7ed60da8fb83" + user-data-script = "./user-data.sh" + asg-min-size = "2" asg-max-size = "4" asg-def-size = "2" alb-name = "rafa-ian-alb" @@ -15,5 +15,5 @@ module "asg" { launch-config-name = "rafa-ian-lc" instance-associate-public-ip = "true" iam-role-name = "engage-ECR-read" - ssh-allowed-ips = ["62.255.97.196/32", "62.255.97.197/32"] + ssh-allowed-ips = ["62.255.97.196/32", "62.6.58.84/32"] }