Skip to content

Commit

Permalink
feat: enable failover designation for a backend (#73)
Browse files Browse the repository at this point in the history
* enable failover designation for a backend

* refactor backends to type to list(any)
  • Loading branch information
denissimonovski authored Aug 26, 2021
1 parent e0ac13b commit 73e89a8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ module "gce-ilb" {
source_tags = ["allow-group1"]
target_tags = ["allow-group2", "allow-group3"]
backends = [
{ group = module.mig2.instance_group, description = "" },
{ group = module.mig3.instance_group, description = "" },
{ group = module.mig2.instance_group, description = "", failover = false },
{ group = module.mig3.instance_group, description = "", failover = false },
]
}
```
Expand Down
2 changes: 2 additions & 0 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ module "gce-ilb" {
{
group = module.mig2.instance_group
description = ""
failover = false
},
{
group = module.mig3.instance_group
description = ""
failover = false
},
]
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "google_compute_region_backend_service" "default" {
content {
group = lookup(backend.value, "group", null)
description = lookup(backend.value, "description", null)
failover = lookup(backend.value, "failover", null)
}
}
health_checks = [var.health_check["type"] == "tcp" ? google_compute_health_check.tcp[0].self_link : google_compute_health_check.http[0].self_link]
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ variable "name" {

variable "backends" {
description = "List of backends, should be a map of key-value pairs for each backend, must have the 'group' key."
type = list(object({ group = string, description = string }))
type = list(any)
}

variable "session_affinity" {
Expand Down

0 comments on commit 73e89a8

Please sign in to comment.