Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add target group target_type variable and depends_on #37

Merged
merged 1 commit into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}