@@ -1003,6 +1003,42 @@ This field must be set for Internal Passthrough Network Load Balancers when the
10031003This field can only be specified when the load balancing scheme is set to INTERNAL, or when the load balancing scheme is set to EXTERNAL and haPolicy fastIpMove is enabled.
10041004Changes to this field force recreation of the resource.` ,
10051005 },
1006+ "network_pass_through_lb_traffic_policy" : {
1007+ Type : schema .TypeList ,
1008+ Optional : true ,
1009+ Description : `Configures traffic steering properties of internal passthrough Network Load Balancers.` ,
1010+ MaxItems : 1 ,
1011+ Elem : & schema.Resource {
1012+ Schema : map [string ]* schema.Schema {
1013+ "zonal_affinity" : {
1014+ Type : schema .TypeList ,
1015+ Optional : true ,
1016+ Description : `When configured, new connections are load balanced across healthy backend endpoints in the local zone.` ,
1017+ MaxItems : 1 ,
1018+ Elem : & schema.Resource {
1019+ Schema : map [string ]* schema.Schema {
1020+ "spillover" : {
1021+ Type : schema .TypeString ,
1022+ Optional : true ,
1023+ ValidateFunc : verify .ValidateEnum ([]string {"ZONAL_AFFINITY_DISABLED" , "ZONAL_AFFINITY_SPILL_CROSS_ZONE" , "ZONAL_AFFINITY_STAY_WITHIN_ZONE" , "" }),
1024+ Description : `This field indicates whether zonal affinity is enabled or not. Default value: "ZONAL_AFFINITY_DISABLED" Possible values: ["ZONAL_AFFINITY_DISABLED", "ZONAL_AFFINITY_SPILL_CROSS_ZONE", "ZONAL_AFFINITY_STAY_WITHIN_ZONE"]` ,
1025+ Default : "ZONAL_AFFINITY_DISABLED" ,
1026+ },
1027+ "spillover_ratio" : {
1028+ Type : schema .TypeFloat ,
1029+ Optional : true ,
1030+ Description : `The value of the field must be in [0, 1]. When the ratio of the count of healthy backend endpoints in a zone
1031+ to the count of backend endpoints in that same zone is equal to or above this threshold, the load balancer
1032+ distributes new connections to all healthy endpoints in the local zone only. When the ratio of the count
1033+ of healthy backend endpoints in a zone to the count of backend endpoints in that same zone is below this
1034+ threshold, the load balancer distributes all new connections to all healthy endpoints across all zones.` ,
1035+ },
1036+ },
1037+ },
1038+ },
1039+ },
1040+ },
1041+ },
10061042 "outlier_detection" : {
10071043 Type : schema .TypeList ,
10081044 Optional : true ,
@@ -1687,6 +1723,12 @@ func resourceComputeRegionBackendServiceCreate(d *schema.ResourceData, meta inte
16871723 } else if v , ok := d .GetOkExists ("custom_metrics" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (customMetricsProp )) && (ok || ! reflect .DeepEqual (v , customMetricsProp )) {
16881724 obj ["customMetrics" ] = customMetricsProp
16891725 }
1726+ networkPassThroughLbTrafficPolicyProp , err := expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicy (d .Get ("network_pass_through_lb_traffic_policy" ), d , config )
1727+ if err != nil {
1728+ return err
1729+ } else if v , ok := d .GetOkExists ("network_pass_through_lb_traffic_policy" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (networkPassThroughLbTrafficPolicyProp )) && (ok || ! reflect .DeepEqual (v , networkPassThroughLbTrafficPolicyProp )) {
1730+ obj ["networkPassThroughLbTrafficPolicy" ] = networkPassThroughLbTrafficPolicyProp
1731+ }
16901732 outlierDetectionProp , err := expandComputeRegionBackendServiceOutlierDetection (d .Get ("outlier_detection" ), d , config )
16911733 if err != nil {
16921734 return err
@@ -2006,6 +2048,9 @@ func resourceComputeRegionBackendServiceRead(d *schema.ResourceData, meta interf
20062048 if err := d .Set ("custom_metrics" , flattenComputeRegionBackendServiceCustomMetrics (res ["customMetrics" ], d , config )); err != nil {
20072049 return fmt .Errorf ("Error reading RegionBackendService: %s" , err )
20082050 }
2051+ if err := d .Set ("network_pass_through_lb_traffic_policy" , flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicy (res ["networkPassThroughLbTrafficPolicy" ], d , config )); err != nil {
2052+ return fmt .Errorf ("Error reading RegionBackendService: %s" , err )
2053+ }
20092054 if err := d .Set ("outlier_detection" , flattenComputeRegionBackendServiceOutlierDetection (res ["outlierDetection" ], d , config )); err != nil {
20102055 return fmt .Errorf ("Error reading RegionBackendService: %s" , err )
20112056 }
@@ -2176,6 +2221,12 @@ func resourceComputeRegionBackendServiceUpdate(d *schema.ResourceData, meta inte
21762221 } else if v , ok := d .GetOkExists ("custom_metrics" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , customMetricsProp )) {
21772222 obj ["customMetrics" ] = customMetricsProp
21782223 }
2224+ networkPassThroughLbTrafficPolicyProp , err := expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicy (d .Get ("network_pass_through_lb_traffic_policy" ), d , config )
2225+ if err != nil {
2226+ return err
2227+ } else if v , ok := d .GetOkExists ("network_pass_through_lb_traffic_policy" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , networkPassThroughLbTrafficPolicyProp )) {
2228+ obj ["networkPassThroughLbTrafficPolicy" ] = networkPassThroughLbTrafficPolicyProp
2229+ }
21792230 outlierDetectionProp , err := expandComputeRegionBackendServiceOutlierDetection (d .Get ("outlier_detection" ), d , config )
21802231 if err != nil {
21812232 return err
@@ -3354,6 +3405,42 @@ func flattenComputeRegionBackendServiceCustomMetricsDryRun(v interface{}, d *sch
33543405 return v
33553406}
33563407
3408+ func flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicy (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3409+ if v == nil {
3410+ return nil
3411+ }
3412+ original := v .(map [string ]interface {})
3413+ if len (original ) == 0 {
3414+ return nil
3415+ }
3416+ transformed := make (map [string ]interface {})
3417+ transformed ["zonal_affinity" ] =
3418+ flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinity (original ["zonalAffinity" ], d , config )
3419+ return []interface {}{transformed }
3420+ }
3421+ func flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinity (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3422+ if v == nil {
3423+ return nil
3424+ }
3425+ original := v .(map [string ]interface {})
3426+ if len (original ) == 0 {
3427+ return nil
3428+ }
3429+ transformed := make (map [string ]interface {})
3430+ transformed ["spillover" ] =
3431+ flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpillover (original ["spillover" ], d , config )
3432+ transformed ["spillover_ratio" ] =
3433+ flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpilloverRatio (original ["spilloverRatio" ], d , config )
3434+ return []interface {}{transformed }
3435+ }
3436+ func flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpillover (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3437+ return v
3438+ }
3439+
3440+ func flattenComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpilloverRatio (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3441+ return v
3442+ }
3443+
33573444func flattenComputeRegionBackendServiceOutlierDetection (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
33583445 if v == nil {
33593446 return nil
@@ -4939,6 +5026,65 @@ func expandComputeRegionBackendServiceCustomMetricsDryRun(v interface{}, d tpgre
49395026 return v , nil
49405027}
49415028
5029+ func expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicy (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
5030+ if v == nil {
5031+ return nil , nil
5032+ }
5033+ l := v .([]interface {})
5034+ if len (l ) == 0 || l [0 ] == nil {
5035+ return nil , nil
5036+ }
5037+ raw := l [0 ]
5038+ original := raw .(map [string ]interface {})
5039+ transformed := make (map [string ]interface {})
5040+
5041+ transformedZonalAffinity , err := expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinity (original ["zonal_affinity" ], d , config )
5042+ if err != nil {
5043+ return nil , err
5044+ } else if val := reflect .ValueOf (transformedZonalAffinity ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
5045+ transformed ["zonalAffinity" ] = transformedZonalAffinity
5046+ }
5047+
5048+ return transformed , nil
5049+ }
5050+
5051+ func expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinity (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
5052+ if v == nil {
5053+ return nil , nil
5054+ }
5055+ l := v .([]interface {})
5056+ if len (l ) == 0 || l [0 ] == nil {
5057+ return nil , nil
5058+ }
5059+ raw := l [0 ]
5060+ original := raw .(map [string ]interface {})
5061+ transformed := make (map [string ]interface {})
5062+
5063+ transformedSpillover , err := expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpillover (original ["spillover" ], d , config )
5064+ if err != nil {
5065+ return nil , err
5066+ } else if val := reflect .ValueOf (transformedSpillover ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
5067+ transformed ["spillover" ] = transformedSpillover
5068+ }
5069+
5070+ transformedSpilloverRatio , err := expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpilloverRatio (original ["spillover_ratio" ], d , config )
5071+ if err != nil {
5072+ return nil , err
5073+ } else if val := reflect .ValueOf (transformedSpilloverRatio ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
5074+ transformed ["spilloverRatio" ] = transformedSpilloverRatio
5075+ }
5076+
5077+ return transformed , nil
5078+ }
5079+
5080+ func expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpillover (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
5081+ return v , nil
5082+ }
5083+
5084+ func expandComputeRegionBackendServiceNetworkPassThroughLbTrafficPolicyZonalAffinitySpilloverRatio (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
5085+ return v , nil
5086+ }
5087+
49425088func expandComputeRegionBackendServiceOutlierDetection (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
49435089 if v == nil {
49445090 return nil , nil
0 commit comments