Skip to content

Commit f5129ef

Browse files
authored
feat: Add support for log_config in google_compute_backend_service. (#88)
BREAKING CHANGE: You must now specify log_config for each backend service. Use `log_config = null` to use the default.
1 parent 0ea26a2 commit f5129ef

File tree

15 files changed

+96
-0
lines changed

15 files changed

+96
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ module "gce-lb-http" {
4545
host = null
4646
}
4747
48+
log_config = {
49+
enable = true
50+
sample_rate = 1.0
51+
}
52+
4853
groups = [
4954
{
5055
# Each node pool instance group should be added to the backend.

autogen/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ module "gce-lb-http" {
5050
host = null
5151
}
5252
53+
log_config = {
54+
enable = true
55+
sample_rate = 1.0
56+
}
57+
5358
groups = [
5459
{
5560
# Each node pool instance group should be added to the backend.

autogen/main.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ resource "google_compute_url_map" "default" {
8686
}
8787

8888
resource "google_compute_backend_service" "default" {
89+
provider = google-beta
8990
for_each = var.backends
9091

9192
project = var.project
@@ -117,6 +118,11 @@ resource "google_compute_backend_service" "default" {
117118
}
118119
}
119120

121+
log_config {
122+
enable = lookup(lookup(each.value, "log_config", {}), "enable", true)
123+
sample_rate = lookup(lookup(each.value, "log_config", {}), "sample_rate", "1.0")
124+
}
125+
120126
depends_on = [google_compute_health_check.default]
121127

122128
{% if dynamic_backends %}

autogen/variables.tf.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ variable "backends" {
8585
port = number
8686
host = string
8787
})
88+
log_config = object({
89+
enable = bool
90+
sample_rate = number
91+
})
8892
groups = list(object({
8993
group = string
9094
balancing_mode = string

examples/https-gke/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ module "gce-lb-https" {
6666
host = null
6767
}
6868

69+
log_config = {
70+
enable = true
71+
sample_rate = 1.0
72+
}
73+
6974
groups = [
7075
{
7176
# Each node pool instance group should be added to the backend.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ module "gce-lb-http" {
115115
host = null
116116
}
117117

118+
log_config = {
119+
enable = false
120+
sample_rate = null
121+
}
122+
118123
groups = [
119124
{
120125
group = module.mig.instance_group

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ module "gce-lb-https" {
145145
connection_draining_timeout_sec = null
146146
enable_cdn = false
147147
health_check = local.health_check
148+
log_config = {
149+
enable = true
150+
sample_rate = 1.0
151+
}
148152
groups = [
149153
{
150154
group = module.mig1.instance_group
@@ -197,6 +201,10 @@ module "gce-lb-https" {
197201
connection_draining_timeout_sec = null
198202
enable_cdn = false
199203
health_check = local.health_check
204+
log_config = {
205+
enable = true
206+
sample_rate = 1.0
207+
}
200208
groups = [
201209
{
202210
group = module.mig1.instance_group
@@ -223,6 +231,10 @@ module "gce-lb-https" {
223231
connection_draining_timeout_sec = null
224232
enable_cdn = false
225233
health_check = local.health_check
234+
log_config = {
235+
enable = true
236+
sample_rate = 1.0
237+
}
226238
groups = [
227239
{
228240
group = module.mig2.instance_group
@@ -249,6 +261,10 @@ module "gce-lb-https" {
249261
connection_draining_timeout_sec = null
250262
enable_cdn = false
251263
health_check = local.health_check
264+
log_config = {
265+
enable = true
266+
sample_rate = 1.0
267+
}
252268
groups = [
253269
{
254270
group = module.mig3.instance_group

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ module "gce-lb-http" {
101101
host = null
102102
}
103103

104+
log_config = {
105+
enable = true
106+
sample_rate = 1.0
107+
}
104108

105109
groups = [
106110
{

examples/multiple-certs/main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ module "gce-lb-https" {
145145
connection_draining_timeout_sec = null
146146
enable_cdn = false
147147
health_check = local.health_check
148+
log_config = {
149+
enable = true
150+
sample_rate = 1.0
151+
}
148152
groups = [
149153
{
150154
group = module.mig1.instance_group
@@ -197,6 +201,10 @@ module "gce-lb-https" {
197201
connection_draining_timeout_sec = null
198202
enable_cdn = false
199203
health_check = local.health_check
204+
log_config = {
205+
enable = true
206+
sample_rate = 1.0
207+
}
200208
groups = [
201209
{
202210
group = module.mig1.instance_group
@@ -223,6 +231,10 @@ module "gce-lb-https" {
223231
connection_draining_timeout_sec = null
224232
enable_cdn = false
225233
health_check = local.health_check
234+
log_config = {
235+
enable = true
236+
sample_rate = 1.0
237+
}
226238
groups = [
227239
{
228240
group = module.mig2.instance_group
@@ -249,6 +261,10 @@ module "gce-lb-https" {
249261
connection_draining_timeout_sec = null
250262
enable_cdn = false
251263
health_check = local.health_check
264+
log_config = {
265+
enable = true
266+
sample_rate = 1.0
267+
}
252268
groups = [
253269
{
254270
group = module.mig3.instance_group

examples/shared-vpc/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ module "gce-lb-http" {
5252
host = null
5353
}
5454

55+
log_config = {
56+
enable = true
57+
sample_rate = 1.0
58+
}
59+
5560
groups = [
5661
{
5762
group = module.mig.instance_group

0 commit comments

Comments
 (0)