Skip to content

Commit

Permalink
Merge pull request #16 from zoitech/enhancement/multiple_host_header_…
Browse files Browse the repository at this point in the history
…support

#15 Multiple host-header support for a single condition
  • Loading branch information
Geartrixy authored Mar 31, 2020
2 parents 9b90f4a + 08e29d7 commit 4538f53
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
24 changes: 15 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
## 1.0.1

ENHANCEMENTS:

* Multiple host-header support for a single condition ([#15](https://github.com/zoitech/terraform-aws-alb/issues/15))

## 1.0.0

BACKWARDS INCOMPATIBILITIES / NOTES:

* Terraform version 0.12.x
* List variables "http_target_group_names", "http_target_group_ports" and "http_host_headers" replaced with list of objects variable "http_target_group_parameters" ([#11](https://github.com/zoitech/terraform-aws-saml/issues/11))
* List variables "https_target_group_names", "https_target_group_ports" and "https_host_headers" replaced with list of objects variable "https_target_group_parameters" ([#11](httpss://github.com/zoitech/terraform-aws-saml/issues/11))
* Changed variable name of "lb_http_listener" to "create_lb_http_listener" ([#12](https://github.com/zoitech/terraform-aws-saml/issues/12))
Changed variable name of "lb_https_listener" to "create_lb_https_listener" ([#12](httpss://github.com/zoitech/terraform-aws-saml/issues/12))
* Changed variable name of "lb_internal" to "create_internal_lb" ([#12](httpss://github.com/zoitech/terraform-aws-saml/issues/12))
* Changed variabble name of "lb_https_offloading" to "enable_lb_https_offloading" ([#12](httpss://github.com/zoitech/terraform-aws-saml/issues/12))
* List variables "http_target_group_names", "http_target_group_ports" and "http_host_headers" replaced with list of objects variable "http_target_group_parameters" ([#11](https://github.com/zoitech/terraform-aws-alb/issues/11))
* List variables "https_target_group_names", "https_target_group_ports" and "https_host_headers" replaced with list of objects variable "https_target_group_parameters" ([#11](httpss://github.com/zoitech/terraform-aws-alb/issues/11))
* Changed variable name of "lb_http_listener" to "create_lb_http_listener" ([#12](https://github.com/zoitech/terraform-aws-alb/issues/12))
Changed variable name of "lb_https_listener" to "create_lb_https_listener" ([#12](httpss://github.com/zoitech/terraform-aws-alb/issues/12))
* Changed variable name of "lb_internal" to "create_internal_lb" ([#12](httpss://github.com/zoitech/terraform-aws-alb/issues/12))
* Changed variabble name of "lb_https_offloading" to "enable_lb_https_offloading" ([#12](httpss://github.com/zoitech/terraform-aws-alb/issues/12))
* Variables "lb_private_subnet_ids" and "lb_public_subnet_ids" replaced with "lb_subnet_ids"

ENHANCEMENTS:

* Upgraded module to terraform 0.12.x ([#10](https://github.com/zoitech/terraform-aws-saml/issues/10))
* Reduced security group complexity ([#13](https://github.com/zoitech/terraform-aws-saml/issues/13))
* Enabled access logs ([#7](https://github.com/zoitech/terraform-aws-saml/issues/7))
* Upgraded module to terraform 0.12.x ([#10](https://github.com/zoitech/terraform-aws-alb/issues/10))
* Reduced security group complexity ([#13](https://github.com/zoitech/terraform-aws-alb/issues/13))
* Enabled access logs ([#7](https://github.com/zoitech/terraform-aws-alb/issues/7))

## 0.0.2

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ module "alb" {
http_target_group_parameters = [
{
target_group = "application-1-http"
host_headers = ["application-1.com"]
host_headers = ["application-1.com", "application-1-co.uk"]
port = 80
},
{
target_group = "application-2-http"
host_headers = ["application-2.com"]
host_headers = ["application-2.com", "application-2.de"]
port = 10002
},
]
Expand All @@ -45,12 +45,12 @@ module "alb" {
https_target_group_parameters = [
{
target_group = "application-1-https"
host_headers = ["application-1.com"]
host_headers = ["application-1.com", "application-1-co.uk"]
port = 443
},
{
target_group = "application-2-https"
host_headers = ["application-2.com"]
host_headers = ["application-2.com", "application-2.de"]
port = 10002
},
]
Expand Down Expand Up @@ -148,7 +148,7 @@ The following outputs are available:

```hcl
module "alb" {
source = "git::https://github.com/zoitech/terraform-aws-alb.git?ref=v1.0.0"
source = "git::https://github.com/zoitech/terraform-aws-alb.git?ref=v1.0.1"
```

## Authors
Expand Down
5 changes: 3 additions & 2 deletions alb_http_listeners.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ resource "aws_lb_listener_rule" "http_host_based_routing" {
}

condition {
field = "host-header"
values = lookup(element(var.http_target_group_parameters, count.index), "host_headers")
host_header {
values = lookup(element(var.http_target_group_parameters, count.index), "host_headers")
}
}

lifecycle {
Expand Down
5 changes: 3 additions & 2 deletions alb_https_listeners.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ resource "aws_lb_listener_rule" "https_host_based_routing" {
}

condition {
field = "host-header"
values = (var.enable_lb_https_offloading == true ? lookup(element(var.http_target_group_parameters, count.index), "host_headers") : lookup(element(var.https_target_group_parameters, count.index), "host_headers"))
host_header {
values = (var.enable_lb_https_offloading == true ? lookup(element(var.http_target_group_parameters, count.index), "host_headers") : lookup(element(var.https_target_group_parameters, count.index), "host_headers"))
}
}
}

0 comments on commit 4538f53

Please sign in to comment.