Created
December 11, 2017 20:53
-
-
Save subzero112233/fea79d53d259d5c2488a580fd0c1d064 to your computer and use it in GitHub Desktop.
terraform
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
data "external" "generate_priority_80" { | |
program = [ | |
"python3", | |
"${path.module}/../helpers/alb_priority/generate_priority.py"] | |
query { | |
listener_arn = "${aws_alb_listener.test123-listener-80.arn}" | |
region = "eu-central-1" | |
component = "${aws_alb_listener_rule.test_rule_80.arn}" | |
} | |
} | |
resource "aws_alb" "test123" { | |
name = "resheftest123" | |
internal = true | |
security_groups = ["sg-blat"] | |
subnets = ["subnet-blat", "subnet-blat2"] | |
idle_timeout = 3600 | |
} | |
resource "aws_alb_listener" "test123-listener-80" { | |
load_balancer_arn = "${aws_alb.test123.arn}" | |
port = "80" | |
protocol = "HTTP" | |
default_action { | |
target_group_arn = "some-arn" | |
type = "forward" | |
} | |
} | |
resource "aws_alb_listener_rule" "test_rule_80" { | |
listener_arn = "${aws_alb_listener.test123-listener-80.arn}" | |
priority = "${data.external.generate_priority_80.result["priority"]}" | |
action { | |
type = "forward" | |
target_group_arn = "some-arn" | |
} | |
condition { | |
field = "host-header" | |
values = [ | |
"test.test.test"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment