Skip to content

Commit 002690d

Browse files
angusfzbrandonjbjelland
authored andcommitted
Add ALB target group target_type variable and depends_on to alb related resource (#37)
1 parent b698c6e commit 002690d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ resource "aws_alb_target_group" "target_group" {
4040
matcher = "${var.health_check_matcher}"
4141
}
4242

43+
target_type = "${var.target_type}"
44+
4345
stickiness {
4446
type = "lb_cookie"
4547
cookie_duration = "${var.cookie_duration}"
4648
enabled = "${ var.cookie_duration == 1 ? false : true}"
4749
}
4850

4951
tags = "${merge(var.tags, map("Name", "${var.alb_name}-tg"))}"
52+
53+
depends_on = ["aws_alb.main"]
5054
}
5155

5256
resource "aws_alb_listener" "frontend_http" {
@@ -59,6 +63,8 @@ resource "aws_alb_listener" "frontend_http" {
5963
target_group_arn = "${aws_alb_target_group.target_group.id}"
6064
type = "forward"
6165
}
66+
67+
depends_on = ["aws_alb.main"]
6268
}
6369

6470
resource "aws_alb_listener" "frontend_https" {
@@ -73,4 +79,6 @@ resource "aws_alb_listener" "frontend_https" {
7379
target_group_arn = "${aws_alb_target_group.target_group.id}"
7480
type = "forward"
7581
}
82+
83+
depends_on = ["aws_alb.main"]
7684
}

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,8 @@ variable "tags" {
124124
variable "vpc_id" {
125125
description = "VPC id where the ALB and other resources will be deployed."
126126
}
127+
128+
variable "target_type" {
129+
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). "
130+
default = "instance"
131+
}

0 commit comments

Comments
 (0)