@@ -390,6 +390,37 @@ func TestAccComputeRegionBackendService_subsettingUpdate(t *testing.T) {
390
390
}
391
391
{{- end }}
392
392
393
+ func TestAccComputeRegionBackendService_withLogConfig(t *testing.T) {
394
+ t.Parallel()
395
+
396
+ serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
397
+ checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
398
+
399
+ acctest.VcrTest(t, resource.TestCase{
400
+ PreCheck: func() { acctest.AccTestPreCheck(t) },
401
+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
402
+ CheckDestroy: testAccCheckComputeRegionBackendServiceDestroyProducer(t),
403
+ Steps: []resource.TestStep{
404
+ {
405
+ Config: testAccComputeRegionBackendService_withLogConfig(serviceName, checkName),
406
+ },
407
+ {
408
+ ResourceName: "google_compute_region_backend_service.foobar",
409
+ ImportState: true,
410
+ ImportStateVerify: true,
411
+ },
412
+ {
413
+ Config: testAccComputeRegionBackendService_withLogConfigDisabled(serviceName, checkName),
414
+ },
415
+ {
416
+ ResourceName: "google_compute_region_backend_service.foobar",
417
+ ImportState: true,
418
+ ImportStateVerify: true,
419
+ },
420
+ },
421
+ })
422
+ }
423
+
393
424
func testAccComputeRegionBackendService_ilbBasic_withUnspecifiedProtocol(serviceName, checkName string) string {
394
425
return fmt.Sprintf(`
395
426
resource "google_compute_region_backend_service" "foobar" {
@@ -1224,3 +1255,61 @@ resource "google_compute_region_security_policy" "policy" {
1224
1255
`, serviceName, polLink, polName)
1225
1256
}
1226
1257
{{- end }}
1258
+
1259
+ func testAccComputeRegionBackendService_withLogConfig(serviceName, checkName string) string {
1260
+ return fmt.Sprintf(`
1261
+ resource "google_compute_region_backend_service" "foobar" {
1262
+ name = "%s"
1263
+ region = "us-central1"
1264
+ health_checks = [google_compute_region_health_check.health_check.self_link]
1265
+ protocol = "HTTP"
1266
+ load_balancing_scheme = "INTERNAL_MANAGED"
1267
+ locality_lb_policy = "ROUND_ROBIN"
1268
+
1269
+ log_config {
1270
+ enable = true
1271
+ sample_rate = 1.0
1272
+ optional_mode = "INCLUDE_ALL_OPTIONAL"
1273
+ }
1274
+ }
1275
+
1276
+ resource "google_compute_region_health_check" "health_check" {
1277
+ name = "%s"
1278
+ region = "us-central1"
1279
+ check_interval_sec = 1
1280
+ timeout_sec = 1
1281
+
1282
+ http_health_check {
1283
+ port = 80
1284
+ }
1285
+ }
1286
+ `, serviceName, checkName)
1287
+ }
1288
+
1289
+ func testAccComputeRegionBackendService_withLogConfigDisabled(serviceName, checkName string) string {
1290
+ return fmt.Sprintf(`
1291
+ resource "google_compute_region_backend_service" "foobar" {
1292
+ name = "%s"
1293
+ region = "us-central1"
1294
+ health_checks = [google_compute_region_health_check.health_check.self_link]
1295
+ protocol = "HTTP"
1296
+ load_balancing_scheme = "INTERNAL_MANAGED"
1297
+ locality_lb_policy = "ROUND_ROBIN"
1298
+
1299
+ log_config {
1300
+ enable = false
1301
+ }
1302
+ }
1303
+
1304
+ resource "google_compute_region_health_check" "health_check" {
1305
+ name = "%s"
1306
+ region = "us-central1"
1307
+ check_interval_sec = 1
1308
+ timeout_sec = 1
1309
+
1310
+ http_health_check {
1311
+ port = 80
1312
+ }
1313
+ }
1314
+ `, serviceName, checkName)
1315
+ }
0 commit comments