@@ -74,6 +74,44 @@ func TestAccComputeBackendService_withBackend(t *testing.T) {
7474 })
7575}
7676
77+ func TestAccComputeBackendService_withBackendAndMaxUtilization (t * testing.T ) {
78+ serviceName := fmt .Sprintf ("tf-test-%s" , randString (t , 10 ))
79+ igName := fmt .Sprintf ("tf-test-%s" , randString (t , 10 ))
80+ itName := fmt .Sprintf ("tf-test-%s" , randString (t , 10 ))
81+ checkName := fmt .Sprintf ("tf-test-%s" , randString (t , 10 ))
82+ vcrTest (t , resource.TestCase {
83+ PreCheck : func () { testAccPreCheck (t ) },
84+ Providers : testAccProviders ,
85+ CheckDestroy : testAccCheckComputeBackendServiceDestroyProducer (t ),
86+ Steps : []resource.TestStep {
87+ {
88+ Config : testAccComputeBackendService_withBackend (
89+ serviceName , igName , itName , checkName , 10 ),
90+ },
91+ {
92+ ResourceName : "google_compute_backend_service.lipsum" ,
93+ ImportState : true ,
94+ ImportStateVerify : true ,
95+ },
96+ {
97+ Config : testAccComputeBackendService_withBackendAndMaxUtilization (
98+ serviceName , igName , itName , checkName , 10 ),
99+ PlanOnly : true ,
100+ ExpectNonEmptyPlan : true ,
101+ },
102+ {
103+ Config : testAccComputeBackendService_withBackendAndMaxUtilization (
104+ serviceName , igName , itName , checkName , 10 ),
105+ },
106+ {
107+ ResourceName : "google_compute_backend_service.lipsum" ,
108+ ImportState : true ,
109+ ImportStateVerify : true ,
110+ },
111+ },
112+ })
113+ }
114+
77115func TestAccComputeBackendService_withBackendAndIAP (t * testing.T ) {
78116 serviceName := fmt .Sprintf ("tf-test-%s" , randString (t , 10 ))
79117 igName := fmt .Sprintf ("tf-test-%s" , randString (t , 10 ))
@@ -929,6 +967,64 @@ resource "google_compute_http_health_check" "default" {
929967` , serviceName , timeout , igName , itName , checkName )
930968}
931969
970+ func testAccComputeBackendService_withBackendAndMaxUtilization (
971+ serviceName , igName , itName , checkName string , timeout int64 ) string {
972+ return fmt .Sprintf (`
973+ data "google_compute_image" "my_image" {
974+ family = "debian-9"
975+ project = "debian-cloud"
976+ }
977+
978+ resource "google_compute_backend_service" "lipsum" {
979+ name = "%s"
980+ description = "Hello World 1234"
981+ port_name = "http"
982+ protocol = "HTTP"
983+ timeout_sec = %v
984+
985+ backend {
986+ group = google_compute_instance_group_manager.foobar.instance_group
987+ max_utilization = 1.0
988+ }
989+
990+ health_checks = [google_compute_http_health_check.default.self_link]
991+ }
992+
993+ resource "google_compute_instance_group_manager" "foobar" {
994+ name = "%s"
995+ version {
996+ instance_template = google_compute_instance_template.foobar.self_link
997+ name = "primary"
998+ }
999+ base_instance_name = "foobar"
1000+ zone = "us-central1-f"
1001+ target_size = 1
1002+ }
1003+
1004+ resource "google_compute_instance_template" "foobar" {
1005+ name = "%s"
1006+ machine_type = "e2-medium"
1007+
1008+ network_interface {
1009+ network = "default"
1010+ }
1011+
1012+ disk {
1013+ source_image = data.google_compute_image.my_image.self_link
1014+ auto_delete = true
1015+ boot = true
1016+ }
1017+ }
1018+
1019+ resource "google_compute_http_health_check" "default" {
1020+ name = "%s"
1021+ request_path = "/"
1022+ check_interval_sec = 1
1023+ timeout_sec = 1
1024+ }
1025+ ` , serviceName , timeout , igName , itName , checkName )
1026+ }
1027+
9321028func testAccComputeBackendService_withBackendAndIAP (
9331029 serviceName , igName , itName , checkName string , timeout int64 ) string {
9341030 return fmt .Sprintf (`
0 commit comments