Skip to content

Instantly share code, notes, and snippets.

View brandonjbjelland's full-sized avatar
🐢
Slow is smooth and smooth is fast

Brandon J. Bjelland brandonjbjelland

🐢
Slow is smooth and smooth is fast
View GitHub Profile
@brandonjbjelland
brandonjbjelland / main.tf
Last active September 6, 2019 06:39
alb test fixture
locals {
target_groups_count = 2
target_groups = "${list(
map("name", "foo",
"backend_protocol", "HTTP",
"backend_port", 80,
),
map("name", "bar",
"backend_protocol", "HTTP",
@brandonjbjelland
brandonjbjelland / variables.tf
Last active September 6, 2019 06:40
alb module variables
variable "target_groups" {
description = "A list of maps containing key/value pairs that define the target groups to be created. Order of these maps is important and the index of these are to be referenced in listener definitions. Required key/values: name, backend_protocol, backend_port. Optional key/values are in the target_groups_defaults variable."
type = "list"
default = []
}
variable "target_groups_count" {
description = "A manually provided count/length of the target_groups list of maps since the list cannot be computed."
default = 0
}
@brandonjbjelland
brandonjbjelland / main.tf
Last active March 23, 2018 04:07
alb module main
resource "aws_lb_target_group" "main" {
name = "${lookup(var.target_groups[count.index], "name")}"
vpc_id = "${var.vpc_id}"
port = "${lookup(var.target_groups[count.index], "backend_port")}"
protocol = "${upper(lookup(var.target_groups[count.index], "backend_protocol"))}"
deregistration_delay = "${lookup(var.target_groups[count.index], "deregistration_delay", lookup(var.target_groups_defaults, "deregistration_delay"))}"
target_type = "${lookup(var.target_groups[count.index], "target_type", lookup(var.target_groups_defaults, "target_type"))}"
health_check {
interval = "${lookup(var.target_groups[count.index], "health_check_interval", lookup(var.target_groups_defaults, "health_check_interval"))}"
@brandonjbjelland
brandonjbjelland / main.tf
Created March 23, 2018 03:41
alb snippets
resource "aws_lb_target_group" "main" {
name = "${lookup(var.target_groups[count.index], "name")}"
vpc_id = "${var.vpc_id}"
port = "${lookup(var.target_groups[count.index], "backend_port")}"
protocol = "${upper(lookup(var.target_groups[count.index], "backend_protocol"))}"
deregistration_delay = "${lookup(var.target_groups[count.index], "deregistration_delay", lookup(var.target_groups_defaults, "deregistration_delay"))}"
target_type = "${lookup(var.target_groups[count.index], "target_type", lookup(var.target_groups_defaults, "target_type"))}"
health_check {
interval = "${lookup(var.target_groups[count.index], "health_check_interval", lookup(var.target_groups_defaults, "health_check_interval"))}"