@@ -218,6 +218,11 @@ func ResourceFrontend() *schema.Resource {
218218 Optional : true ,
219219 Default : false ,
220220 },
221+ "connection_rate_limit" : {
222+ Type : schema .TypeInt ,
223+ Optional : true ,
224+ Description : "Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second" ,
225+ },
221226 },
222227 }
223228}
@@ -265,13 +270,14 @@ func resourceLbFrontendCreate(ctx context.Context, d *schema.ResourceData, m int
265270 }
266271
267272 createFrontendRequest := & lbSDK.ZonedAPICreateFrontendRequest {
268- Zone : zone ,
269- LBID : lbID ,
270- Name : types .ExpandOrGenerateString (d .Get ("name" ), "lb-frt" ),
271- InboundPort : int32 (d .Get ("inbound_port" ).(int )),
272- BackendID : locality .ExpandID (d .Get ("backend_id" )),
273- TimeoutClient : timeoutClient ,
274- EnableHTTP3 : d .Get ("enable_http3" ).(bool ),
273+ Zone : zone ,
274+ LBID : lbID ,
275+ Name : types .ExpandOrGenerateString (d .Get ("name" ), "lb-frt" ),
276+ InboundPort : int32 (d .Get ("inbound_port" ).(int )),
277+ BackendID : locality .ExpandID (d .Get ("backend_id" )),
278+ TimeoutClient : timeoutClient ,
279+ EnableHTTP3 : d .Get ("enable_http3" ).(bool ),
280+ ConnectionRateLimit : types .ExpandUint32Ptr (d .Get ("connection_rate_limit" )),
275281 }
276282
277283 certificatesRaw , certificatesExist := d .GetOk ("certificate_ids" )
@@ -319,6 +325,7 @@ func resourceLbFrontendRead(ctx context.Context, d *schema.ResourceData, m inter
319325 _ = d .Set ("inbound_port" , int (frontend .InboundPort ))
320326 _ = d .Set ("timeout_client" , types .FlattenDuration (frontend .TimeoutClient ))
321327 _ = d .Set ("enable_http3" , frontend .EnableHTTP3 )
328+ _ = d .Set ("connection_rate_limit" , types .FlattenUint32Ptr (frontend .ConnectionRateLimit ))
322329
323330 if frontend .Certificate != nil { //nolint:staticcheck
324331 _ = d .Set ("certificate_id" , zonal .NewIDString (zone , frontend .Certificate .ID )) //nolint:staticcheck
@@ -474,14 +481,15 @@ func resourceLbFrontendUpdate(ctx context.Context, d *schema.ResourceData, m int
474481 }
475482
476483 req := & lbSDK.ZonedAPIUpdateFrontendRequest {
477- Zone : zone ,
478- FrontendID : ID ,
479- Name : types .ExpandOrGenerateString (d .Get ("name" ), "lb-frt" ),
480- InboundPort : int32 (d .Get ("inbound_port" ).(int )),
481- BackendID : locality .ExpandID (d .Get ("backend_id" )),
482- TimeoutClient : timeoutClient ,
483- CertificateIDs : types .ExpandSliceIDsPtr (d .Get ("certificate_ids" )),
484- EnableHTTP3 : d .Get ("enable_http3" ).(bool ),
484+ Zone : zone ,
485+ FrontendID : ID ,
486+ Name : types .ExpandOrGenerateString (d .Get ("name" ), "lb-frt" ),
487+ InboundPort : int32 (d .Get ("inbound_port" ).(int )),
488+ BackendID : locality .ExpandID (d .Get ("backend_id" )),
489+ TimeoutClient : timeoutClient ,
490+ CertificateIDs : types .ExpandSliceIDsPtr (d .Get ("certificate_ids" )),
491+ EnableHTTP3 : d .Get ("enable_http3" ).(bool ),
492+ ConnectionRateLimit : types .ExpandUint32Ptr (d .Get ("connection_rate_limit" )),
485493 }
486494
487495 _ , err = lbAPI .UpdateFrontend (req , scw .WithContext (ctx ))
0 commit comments