Skip to content

Commit f2b8f3c

Browse files
authored
feat: Add health check logging support (#98)
* Add health check logging support Signed-off-by: Dev <[email protected]> * Set health check resource to use beta provider Signed-off-by: Dev <[email protected]> * Remove dynamic block, bump to 3.17 min provider Signed-off-by: Dev <[email protected]>
1 parent 478f575 commit f2b8f3c

File tree

21 files changed

+36
-9
lines changed

21 files changed

+36
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module "gce-lb-http" {
4545
request_path = "/"
4646
port = var.service_port
4747
host = null
48+
logging = null
4849
}
4950
5051
log_config = {

autogen/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module "gce-lb-http" {
5050
request_path = "/"
5151
port = var.service_port
5252
host = null
53+
logging = null
5354
}
5455
5556
log_config = {

autogen/main.tf.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ resource "google_compute_backend_service" "default" {
135135
}
136136

137137
resource "google_compute_health_check" "default" {
138+
provider = google-beta
138139
for_each = var.backends
139140
project = var.project
140141
name = "${var.name}-hc-${each.key}"
@@ -144,6 +145,10 @@ resource "google_compute_health_check" "default" {
144145
healthy_threshold = lookup(each.value["health_check"], "healthy_threshold", 2)
145146
unhealthy_threshold = lookup(each.value["health_check"], "unhealthy_threshold", 2)
146147

148+
log_config {
149+
enable = lookup(each.value["health_check"], "logging", false)
150+
}
151+
147152
dynamic "http_health_check" {
148153
for_each = each.value["protocol"] == "HTTP" ? [
149154
{

autogen/variables.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ variable "backends" {
8686
request_path = string
8787
port = number
8888
host = string
89+
logging = bool
8990
})
9091
log_config = object({
9192
enable = bool

autogen/versions.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
terraform {
1818
required_version = "~> 0.12.6"
1919
required_providers {
20-
google = ">= 2.15, <4.0.0"
21-
google-beta = ">= 2.15, <4.0.0"
20+
google = ">= 3.17, <4.0.0"
21+
google-beta = ">= 3.17, <4.0.0"
2222
}
2323
}

examples/https-gke/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ module "gce-lb-https" {
6666
request_path = "/"
6767
port = var.service_port
6868
host = null
69+
logging = true
6970
}
7071

7172
log_config = {

examples/mig-nat-http-lb/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ module "gce-lb-http" {
115115
request_path = "/"
116116
port = 80
117117
host = null
118+
logging = null
118119
}
119120

120121
log_config = {

examples/multi-backend-multi-mig-bucket-https-lb/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ locals {
113113
request_path = "/"
114114
port = 80
115115
host = null
116+
logging = null
116117
}
117118
}
118119

examples/multi-mig-http-lb/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ module "gce-lb-http" {
100100
request_path = "/"
101101
port = 80
102102
host = null
103+
logging = null
103104
}
104105

105106
log_config = {

examples/multiple-certs/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ locals {
113113
request_path = "/"
114114
port = 80
115115
host = null
116+
logging = null
116117
}
117118
}
118119

0 commit comments

Comments
 (0)