Skip to content

Instantly share code, notes, and snippets.

@subzero112233
Created December 11, 2017 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subzero112233/fea79d53d259d5c2488a580fd0c1d064 to your computer and use it in GitHub Desktop.
Save subzero112233/fea79d53d259d5c2488a580fd0c1d064 to your computer and use it in GitHub Desktop.
terraform
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