@@ -387,9 +387,6 @@ func TestAccComputeRegionTargetHttpsProxy_addSslPolicy_withForwardingRule(t *tes
387
387
func testAccComputeRegionTargetHttpsProxy_withForwardingRule(context map[string]interface{}) string {
388
388
return acctest.Nprintf(`
389
389
resource "google_compute_forwarding_rule" "default-https" {
390
- <% unless version == 'ga' -%>
391
- provider = google-beta
392
- <% end -%>
393
390
project = "%{project_id}"
394
391
region = "us-central1"
395
392
name = "https-frwd-rule-%{resource_suffix}"
@@ -405,9 +402,6 @@ resource "google_compute_forwarding_rule" "default-https" {
405
402
}
406
403
407
404
resource "google_compute_region_backend_service" "default" {
408
- <% unless version == 'ga' -%>
409
- provider = google-beta
410
- <% end -%>
411
405
project = "%{project_id}"
412
406
region = "us-central1"
413
407
name = "backend-service-%{resource_suffix}"
@@ -442,9 +436,6 @@ resource "google_compute_region_backend_service" "default" {
442
436
}
443
437
444
438
resource "google_compute_region_health_check" "default" {
445
- <% unless version == 'ga' -%>
446
- provider = google-beta
447
- <% end -%>
448
439
project = "%{project_id}"
449
440
region = "us-central1"
450
441
name = "hc-%{resource_suffix}"
@@ -460,9 +451,6 @@ resource "google_compute_region_health_check" "default" {
460
451
}
461
452
462
453
resource "google_compute_region_target_https_proxy" "default-https" {
463
- <% unless version == 'ga' -%>
464
- provider = google-beta
465
- <% end -%>
466
454
project = "%{project_id}"
467
455
region = "us-central1"
468
456
name = "https-proxy-%{resource_suffix}"
@@ -471,47 +459,32 @@ resource "google_compute_region_target_https_proxy" "default-https" {
471
459
}
472
460
473
461
resource "google_compute_region_url_map" "default-https" {
474
- <% unless version == 'ga' -%>
475
- provider = google-beta
476
- <% end -%>
477
462
project = "%{project_id}"
478
463
region = "us-central1"
479
464
name = "lb-%{resource_suffix}"
480
465
default_service = google_compute_region_backend_service.default.id
481
466
}
482
467
483
468
resource "google_compute_region_ssl_certificate" "foobar0" {
484
- <% unless version == 'ga' -%>
485
- provider = google-beta
486
- <% end -%>
487
469
name = "httpsproxy-test-cert0-%{resource_suffix}"
488
470
description = "very descriptive"
489
471
private_key = file("test-fixtures/test.key")
490
472
certificate = file("test-fixtures/test.crt")
491
473
}
492
474
493
475
resource "google_compute_network" "ilb_network" {
494
- <% unless version == 'ga' -%>
495
- provider = google-beta
496
- <% end -%>
497
476
name = "tf-test-l4-ilb-network-%{resource_suffix}"
498
477
auto_create_subnetworks = false
499
478
}
500
479
501
480
resource "google_compute_subnetwork" "ilb_subnet" {
502
- <% unless version == 'ga' -%>
503
- provider = google-beta
504
- <% end -%>
505
481
name = "tf-test-l4-ilb-subnet-%{resource_suffix}"
506
482
ip_cidr_range = "10.0.1.0/24"
507
483
region = "us-central1"
508
484
network = google_compute_network.ilb_network.id
509
485
}
510
486
511
487
resource "google_compute_subnetwork" "ilb_subnet2" {
512
- <% unless version == 'ga' -%>
513
- provider = google-beta
514
- <% end -%>
515
488
name = "tf-test-l4-ilb-subnet2-%{resource_suffix}"
516
489
ip_cidr_range = "10.142.0.0/20"
517
490
region = "us-central1"
@@ -521,9 +494,6 @@ resource "google_compute_subnetwork" "ilb_subnet2" {
521
494
}
522
495
523
496
resource "google_compute_address" "consumer_address" {
524
- <% unless version == 'ga' -%>
525
- provider = google-beta
526
- <% end -%>
527
497
name = "tf-test-website-ip-%{resource_suffix}-1"
528
498
region = "us-central1"
529
499
subnetwork = google_compute_subnetwork.ilb_subnet.id
@@ -676,7 +646,7 @@ func TestAccComputeRegionTargetHttpsProxy_addServerTlsPolicy_withForwardingRule(
676
646
CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroyProducer(t),
677
647
Steps: []resource.TestStep{
678
648
{
679
- Config: testAccComputeRegionTargetHttpsProxy_withForwardingRule (context),
649
+ Config: testAccComputeRegionTargetHttpsProxy_withForwardingRule_withoutServerTlsPolicy (context),
680
650
},
681
651
{
682
652
ResourceName: "google_compute_region_target_https_proxy.default-https",
@@ -695,6 +665,144 @@ func TestAccComputeRegionTargetHttpsProxy_addServerTlsPolicy_withForwardingRule(
695
665
})
696
666
}
697
667
668
+ func testAccComputeRegionTargetHttpsProxy_withForwardingRule_withoutServerTlsPolicy(context map[string]interface{}) string {
669
+ return acctest.Nprintf(`
670
+ resource "google_compute_forwarding_rule" "default-https" {
671
+ provider = google-beta
672
+
673
+ project = "%{project_id}"
674
+ region = "us-central1"
675
+ name = "https-frwd-rule-%{resource_suffix}"
676
+ load_balancing_scheme = "INTERNAL_MANAGED"
677
+ target = google_compute_region_target_https_proxy.default-https.self_link
678
+ network = google_compute_network.ilb_network.name
679
+ subnetwork = google_compute_subnetwork.ilb_subnet.name
680
+ ip_address = google_compute_address.consumer_address.id
681
+ ip_protocol = "TCP"
682
+ port_range = "443"
683
+ allow_global_access = "true"
684
+ depends_on = [google_compute_subnetwork.ilb_subnet2]
685
+ }
686
+
687
+ resource "google_compute_region_backend_service" "default" {
688
+ provider = google-beta
689
+
690
+ project = "%{project_id}"
691
+ region = "us-central1"
692
+ name = "backend-service-%{resource_suffix}"
693
+ protocol = "HTTPS"
694
+ port_name = "https-server"
695
+ load_balancing_scheme = "INTERNAL_MANAGED"
696
+ session_affinity = "HTTP_COOKIE"
697
+ health_checks = [google_compute_region_health_check.default.self_link]
698
+ locality_lb_policy = "RING_HASH"
699
+
700
+ # websocket handling: https://stackoverflow.com/questions/63822612/websocket-connection-being-closed-on-google-compute-engine
701
+ timeout_sec = 600
702
+
703
+ consistent_hash {
704
+ http_cookie {
705
+ ttl {
706
+ # 24hr cookie ttl
707
+ seconds = 86400
708
+ nanos = null
709
+ }
710
+ name = "X-CLIENT-SESSION"
711
+ path = null
712
+ }
713
+ http_header_name = null
714
+ minimum_ring_size = 1024
715
+ }
716
+
717
+ log_config {
718
+ enable = true
719
+ sample_rate = 1.0
720
+ }
721
+ }
722
+
723
+ resource "google_compute_region_health_check" "default" {
724
+ provider = google-beta
725
+
726
+ project = "%{project_id}"
727
+ region = "us-central1"
728
+ name = "hc-%{resource_suffix}"
729
+ timeout_sec = 5
730
+ check_interval_sec = 30
731
+ healthy_threshold = 3
732
+ unhealthy_threshold = 3
733
+
734
+ https_health_check {
735
+ port = 443
736
+ request_path = "/health"
737
+ }
738
+ }
739
+
740
+ resource "google_compute_region_target_https_proxy" "default-https" {
741
+ provider = google-beta
742
+
743
+ project = "%{project_id}"
744
+ region = "us-central1"
745
+ name = "https-proxy-%{resource_suffix}"
746
+ url_map = google_compute_region_url_map.default-https.self_link
747
+ ssl_certificates = [google_compute_region_ssl_certificate.foobar0.self_link]
748
+ }
749
+
750
+ resource "google_compute_region_url_map" "default-https" {
751
+ provider = google-beta
752
+
753
+ project = "%{project_id}"
754
+ region = "us-central1"
755
+ name = "lb-%{resource_suffix}"
756
+ default_service = google_compute_region_backend_service.default.id
757
+ }
758
+
759
+ resource "google_compute_region_ssl_certificate" "foobar0" {
760
+ provider = google-beta
761
+
762
+ name = "httpsproxy-test-cert0-%{resource_suffix}"
763
+ description = "very descriptive"
764
+ private_key = file("test-fixtures/test.key")
765
+ certificate = file("test-fixtures/test.crt")
766
+ }
767
+
768
+ resource "google_compute_network" "ilb_network" {
769
+ provider = google-beta
770
+
771
+ name = "tf-test-l4-ilb-network-%{resource_suffix}"
772
+ auto_create_subnetworks = false
773
+ }
774
+
775
+ resource "google_compute_subnetwork" "ilb_subnet" {
776
+ provider = google-beta
777
+
778
+ name = "tf-test-l4-ilb-subnet-%{resource_suffix}"
779
+ ip_cidr_range = "10.0.1.0/24"
780
+ region = "us-central1"
781
+ network = google_compute_network.ilb_network.id
782
+ }
783
+
784
+ resource "google_compute_subnetwork" "ilb_subnet2" {
785
+ provider = google-beta
786
+
787
+ name = "tf-test-l4-ilb-subnet2-%{resource_suffix}"
788
+ ip_cidr_range = "10.142.0.0/20"
789
+ region = "us-central1"
790
+ purpose = "REGIONAL_MANAGED_PROXY"
791
+ role = "ACTIVE"
792
+ network = google_compute_network.ilb_network.id
793
+ }
794
+
795
+ resource "google_compute_address" "consumer_address" {
796
+ provider = google-beta
797
+
798
+ name = "tf-test-website-ip-%{resource_suffix}-1"
799
+ region = "us-central1"
800
+ subnetwork = google_compute_subnetwork.ilb_subnet.id
801
+ address_type = "INTERNAL"
802
+ }
803
+ `, context)
804
+ }
805
+
698
806
func testAccComputeRegionTargetHttpsProxy_withForwardingRule_withServerTlsPolicy(context map[string]interface{}) string {
699
807
return acctest.Nprintf(`
700
808
0 commit comments