@@ -2252,6 +2252,21 @@ func ResourceContainerCluster() *schema.Resource {
2252
2252
Description : `Defines the config of in-transit encryption` ,
2253
2253
ValidateFunc : validation .StringInSlice ([]string {"IN_TRANSIT_ENCRYPTION_CONFIG_UNSPECIFIED" , "IN_TRANSIT_ENCRYPTION_DISABLED" , "IN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT" }, false ),
2254
2254
},
2255
+ "network_performance_config" : {
2256
+ Type : schema .TypeList ,
2257
+ Optional : true ,
2258
+ MaxItems : 1 ,
2259
+ Description : `Network bandwidth tier configuration.` ,
2260
+ Elem : & schema.Resource {
2261
+ Schema : map [string ]* schema.Schema {
2262
+ "total_egress_bandwidth_tier" : {
2263
+ Type : schema .TypeString ,
2264
+ Required : true ,
2265
+ Description : `Specifies the total network bandwidth tier for NodePools in the cluster.` ,
2266
+ },
2267
+ },
2268
+ },
2269
+ },
2255
2270
},
2256
2271
}
2257
2272
}
@@ -2412,6 +2427,7 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
2412
2427
EnableMultiNetworking : d .Get ("enable_multi_networking" ).(bool ),
2413
2428
DefaultEnablePrivateNodes : expandDefaultEnablePrivateNodes (d ),
2414
2429
EnableFqdnNetworkPolicy : d .Get ("enable_fqdn_network_policy" ).(bool ),
2430
+ NetworkPerformanceConfig : expandNetworkPerformanceConfig (d .Get ("network_performance_config" )),
2415
2431
},
2416
2432
MasterAuth : expandMasterAuth (d .Get ("master_auth" )),
2417
2433
NotificationConfig : expandNotificationConfig (d .Get ("notification_config" )),
@@ -3078,6 +3094,9 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
3078
3094
if err := d .Set ("gateway_api_config" , flattenGatewayApiConfig (cluster .NetworkConfig .GatewayApiConfig )); err != nil {
3079
3095
return err
3080
3096
}
3097
+ if err := d .Set ("network_performance_config" , flattenNetworkPerformanceConfig (cluster .NetworkConfig .NetworkPerformanceConfig )); err != nil {
3098
+ return err
3099
+ }
3081
3100
if err := d .Set ("fleet" , flattenFleet (cluster .Fleet )); err != nil {
3082
3101
return err
3083
3102
}
@@ -4284,6 +4303,24 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
4284
4303
log .Printf ("[INFO] GKE cluster %s resource usage export config has been updated" , d .Id ())
4285
4304
}
4286
4305
4306
+ if d .HasChange ("network_performance_config" ) {
4307
+ if npc , ok := d .GetOk ("network_performance_config" ); ok {
4308
+ req := & container.UpdateClusterRequest {
4309
+ Update : & container.ClusterUpdate {
4310
+ DesiredNetworkPerformanceConfig : expandNetworkPerformanceConfig (npc ),
4311
+ },
4312
+ }
4313
+
4314
+ updateF := updateFunc (req , "updating GKE Network Performance Config" )
4315
+ // Call update serially.
4316
+ if err := transport_tpg .LockedCall (lockKey , updateF ); err != nil {
4317
+ return err
4318
+ }
4319
+
4320
+ log .Printf ("[INFO] GKE cluster %s Network Performance Config has been updated" , d .Id ())
4321
+ }
4322
+ }
4323
+
4287
4324
if d .HasChange ("gateway_api_config" ) {
4288
4325
if gac , ok := d .GetOk ("gateway_api_config" ); ok {
4289
4326
req := & container.UpdateClusterRequest {
@@ -5629,6 +5666,18 @@ func expandDnsConfig(configured interface{}) *container.DNSConfig {
5629
5666
}
5630
5667
}
5631
5668
5669
+ func expandNetworkPerformanceConfig (configured interface {}) * container.ClusterNetworkPerformanceConfig {
5670
+ l := configured .([]interface {})
5671
+ if len (l ) == 0 || l [0 ] == nil {
5672
+ return nil
5673
+ }
5674
+
5675
+ config := l [0 ].(map [string ]interface {})
5676
+ return & container.ClusterNetworkPerformanceConfig {
5677
+ TotalEgressBandwidthTier : config ["total_egress_bandwidth_tier" ].(string ),
5678
+ }
5679
+ }
5680
+
5632
5681
func expandGatewayApiConfig (configured interface {}) * container.GatewayAPIConfig {
5633
5682
l := configured .([]interface {})
5634
5683
if len (l ) == 0 || l [0 ] == nil {
@@ -6548,6 +6597,17 @@ func flattenDnsConfig(c *container.DNSConfig) []map[string]interface{} {
6548
6597
}
6549
6598
}
6550
6599
6600
+ func flattenNetworkPerformanceConfig (c * container.ClusterNetworkPerformanceConfig ) []map [string ]interface {} {
6601
+ if c == nil {
6602
+ return nil
6603
+ }
6604
+ return []map [string ]interface {}{
6605
+ {
6606
+ "total_egress_bandwidth_tier" : c .TotalEgressBandwidthTier ,
6607
+ },
6608
+ }
6609
+ }
6610
+
6551
6611
func flattenGatewayApiConfig (c * container.GatewayAPIConfig ) []map [string ]interface {} {
6552
6612
if c == nil {
6553
6613
return nil
0 commit comments