Created
December 12, 2018 18:19
-
-
Save 20k-ultra/de86bfa699c23ae663e868a9390af769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_alb" "alb_qriket" { | |
name = "${var.environment}-alb-qriket" | |
subnets = ["${var.public_subnet_ids}"] | |
security_groups = ["${var.security_groups_ids}", "${aws_security_group.web_inbound_sg.id}"] | |
tags { | |
Name = "${var.environment}-alb-qriket" | |
Environment = "${var.environment}" | |
} | |
} | |
resource "aws_alb_target_group" "alb_target_group" { | |
name = "${var.environment}-alb-target-group-${random_id.target_group_sufix.hex}" | |
port = 443 | |
protocol = "HTTPS" | |
vpc_id = "${var.vpc_id}" | |
target_type = "ip" | |
health_check { | |
path = "/" | |
port = "80" | |
protocol = "HTTP" | |
healthy_threshold = 2 | |
unhealthy_threshold = 2 | |
interval = 5 | |
timeout = 4 | |
matcher = "200-308" | |
} | |
} | |
resource "aws_alb_listener" "qriket" { | |
load_balancer_arn = "${aws_alb.alb_qriket.arn}" | |
port = "443" | |
protocol = "HTTPS" | |
ssl_policy = "${var.ssl_policy}" | |
certificate_arn = "${var.certificate_arn}" | |
depends_on = ["aws_alb_target_group.alb_target_group"] | |
default_action { | |
target_group_arn = "${aws_alb_target_group.alb_target_group.arn}" | |
type = "forward" | |
} | |
lifecycle { | |
create_before_destroy = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment