@@ -485,6 +485,32 @@ which means no health check logging will be done.`,
485
485
},
486
486
},
487
487
},
488
+ "source_regions" : {
489
+ Type : schema .TypeList ,
490
+ Optional : true ,
491
+ Description : `The list of cloud regions from which health checks are performed. If
492
+ any regions are specified, then exactly 3 regions should be specified.
493
+ The region names must be valid names of Google Cloud regions. This can
494
+ only be set for global health check. If this list is non-empty, then
495
+ there are restrictions on what other health check fields are supported
496
+ and what other resources can use this health check:
497
+
498
+ * SSL, HTTP2, and GRPC protocols are not supported.
499
+
500
+ * The TCP request field is not supported.
501
+
502
+ * The proxyHeader field for HTTP, HTTPS, and TCP is not supported.
503
+
504
+ * The checkIntervalSec field must be at least 30.
505
+
506
+ * The health check cannot be used with BackendService nor with managed
507
+ instance group auto-healing.` ,
508
+ MinItems : 3 ,
509
+ MaxItems : 3 ,
510
+ Elem : & schema.Schema {
511
+ Type : schema .TypeString ,
512
+ },
513
+ },
488
514
"ssl_health_check" : {
489
515
Type : schema .TypeList ,
490
516
Optional : true ,
@@ -707,6 +733,12 @@ func resourceComputeHealthCheckCreate(d *schema.ResourceData, meta interface{})
707
733
} else if v , ok := d .GetOkExists ("timeout_sec" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (timeoutSecProp )) && (ok || ! reflect .DeepEqual (v , timeoutSecProp )) {
708
734
obj ["timeoutSec" ] = timeoutSecProp
709
735
}
736
+ sourceRegionsProp , err := expandComputeHealthCheckSourceRegions (d .Get ("source_regions" ), d , config )
737
+ if err != nil {
738
+ return err
739
+ } else if v , ok := d .GetOkExists ("source_regions" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (sourceRegionsProp )) && (ok || ! reflect .DeepEqual (v , sourceRegionsProp )) {
740
+ obj ["sourceRegions" ] = sourceRegionsProp
741
+ }
710
742
unhealthyThresholdProp , err := expandComputeHealthCheckUnhealthyThreshold (d .Get ("unhealthy_threshold" ), d , config )
711
743
if err != nil {
712
744
return err
@@ -877,6 +909,9 @@ func resourceComputeHealthCheckRead(d *schema.ResourceData, meta interface{}) er
877
909
if err := d .Set ("timeout_sec" , flattenComputeHealthCheckTimeoutSec (res ["timeoutSec" ], d , config )); err != nil {
878
910
return fmt .Errorf ("Error reading HealthCheck: %s" , err )
879
911
}
912
+ if err := d .Set ("source_regions" , flattenComputeHealthCheckSourceRegions (res ["sourceRegions" ], d , config )); err != nil {
913
+ return fmt .Errorf ("Error reading HealthCheck: %s" , err )
914
+ }
880
915
if err := d .Set ("unhealthy_threshold" , flattenComputeHealthCheckUnhealthyThreshold (res ["unhealthyThreshold" ], d , config )); err != nil {
881
916
return fmt .Errorf ("Error reading HealthCheck: %s" , err )
882
917
}
@@ -957,6 +992,12 @@ func resourceComputeHealthCheckUpdate(d *schema.ResourceData, meta interface{})
957
992
} else if v , ok := d .GetOkExists ("timeout_sec" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , timeoutSecProp )) {
958
993
obj ["timeoutSec" ] = timeoutSecProp
959
994
}
995
+ sourceRegionsProp , err := expandComputeHealthCheckSourceRegions (d .Get ("source_regions" ), d , config )
996
+ if err != nil {
997
+ return err
998
+ } else if v , ok := d .GetOkExists ("source_regions" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , sourceRegionsProp )) {
999
+ obj ["sourceRegions" ] = sourceRegionsProp
1000
+ }
960
1001
unhealthyThresholdProp , err := expandComputeHealthCheckUnhealthyThreshold (d .Get ("unhealthy_threshold" ), d , config )
961
1002
if err != nil {
962
1003
return err
@@ -1191,6 +1232,10 @@ func flattenComputeHealthCheckTimeoutSec(v interface{}, d *schema.ResourceData,
1191
1232
return v // let terraform core handle it otherwise
1192
1233
}
1193
1234
1235
+ func flattenComputeHealthCheckSourceRegions (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1236
+ return v
1237
+ }
1238
+
1194
1239
func flattenComputeHealthCheckUnhealthyThreshold (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1195
1240
// Handles the string fixed64 format
1196
1241
if strVal , ok := v .(string ); ok {
@@ -1611,6 +1656,10 @@ func expandComputeHealthCheckTimeoutSec(v interface{}, d tpgresource.TerraformRe
1611
1656
return v , nil
1612
1657
}
1613
1658
1659
+ func expandComputeHealthCheckSourceRegions (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1660
+ return v , nil
1661
+ }
1662
+
1614
1663
func expandComputeHealthCheckUnhealthyThreshold (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1615
1664
return v , nil
1616
1665
}
0 commit comments