Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module "gce-ilb" {
| ip\_protocol | The IP protocol for the backend and frontend forwarding rule. TCP or UDP. | `string` | `"TCP"` | no |
| is\_mirroring\_collector | Indicates whether or not this load balancer can be used as a collector for packet mirroring. This can only be set to true for load balancers that have their loadBalancingScheme set to INTERNAL. | `bool` | `false` | no |
| labels | The labels to attach to resources created by this module. | `map(string)` | `{}` | no |
| log\_config | This field denotes the logging options for the load balancer traffic served by this backend service. | <pre>object({<br> enable = bool<br> sample_rate = number<br> })</pre> | <pre>{<br> "enable": true,<br> "sample_rate": 1<br>}</pre> | no |
| name | Name for the forwarding rule and prefix for supporting resources. | `string` | n/a | yes |
| network | Name of the network to create resources in. | `string` | `"default"` | no |
| network\_project | Name of the project for the network. Useful for shared VPC. Default is var.project. | `string` | `""` | no |
Expand Down
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,16 @@ resource "google_compute_region_backend_service" "default" {
balancing_mode = lookup(backend.value, "balancing_mode", "CONNECTION")
}
}

health_checks = concat(google_compute_health_check.tcp[*].self_link, google_compute_health_check.http[*].self_link, google_compute_health_check.https[*].self_link)

dynamic "log_config" {
for_each = var.log_config.enable ? [1] : []
content {
enable = var.log_config.enable
sample_rate = var.log_config.sample_rate
}
}
}

resource "google_compute_health_check" "tcp" {
Expand Down
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,12 @@ variable "is_mirroring_collector" {
default = false
type = bool
}

variable "log_config" {
description = "This field denotes the logging options for the load balancer traffic served by this backend service."
type = object({
enable = bool
sample_rate = number
})
default = { enable = true, sample_rate = 1.0 }
}