Skip to content

Commit

Permalink
Add ALB target group target_type variable and depends_on to alb relat…
Browse files Browse the repository at this point in the history
…ed resource (#37)
  • Loading branch information
angusfz authored and brandonjbjelland committed Feb 15, 2018
1 parent b698c6e commit 002690d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ resource "aws_alb_target_group" "target_group" {
matcher = "${var.health_check_matcher}"
}

target_type = "${var.target_type}"

stickiness {
type = "lb_cookie"
cookie_duration = "${var.cookie_duration}"
enabled = "${ var.cookie_duration == 1 ? false : true}"
}

tags = "${merge(var.tags, map("Name", "${var.alb_name}-tg"))}"

depends_on = ["aws_alb.main"]
}

resource "aws_alb_listener" "frontend_http" {
Expand All @@ -59,6 +63,8 @@ resource "aws_alb_listener" "frontend_http" {
target_group_arn = "${aws_alb_target_group.target_group.id}"
type = "forward"
}

depends_on = ["aws_alb.main"]
}

resource "aws_alb_listener" "frontend_https" {
Expand All @@ -73,4 +79,6 @@ resource "aws_alb_listener" "frontend_https" {
target_group_arn = "${aws_alb_target_group.target_group.id}"
type = "forward"
}

depends_on = ["aws_alb.main"]
}
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,8 @@ variable "tags" {
variable "vpc_id" {
description = "VPC id where the ALB and other resources will be deployed."
}

variable "target_type" {
description = "The type of target that you must specify when registering targets with this target group. The possible values are instance (targets are specified by instance ID) or ip (targets are specified by IP address). "
default = "instance"
}

0 comments on commit 002690d

Please sign in to comment.