diff --git a/docs/resources/loadbalance_virtual_server.md b/docs/resources/loadbalance_virtual_server.md index 730d620..dbe566c 100644 --- a/docs/resources/loadbalance_virtual_server.md +++ b/docs/resources/loadbalance_virtual_server.md @@ -55,6 +55,7 @@ resource "fortiadc_loadbalance_virtual_server" "myvirtualserver" { * `error_msg` - (Optional) Error message on backend failure. * `error_page` - (Optional) Error page on backend failure. * `persistence` - (Optional) Persistence configuration. +* `transaction_rate_limit` - (Optional) Limit of transactions per second. Defaults to `0`. ## Attribute Reference diff --git a/fortiadc/resource_fortiadc_loadbalance_virtual_server.go b/fortiadc/resource_fortiadc_loadbalance_virtual_server.go index 580f721..c6b0646 100644 --- a/fortiadc/resource_fortiadc_loadbalance_virtual_server.go +++ b/fortiadc/resource_fortiadc_loadbalance_virtual_server.go @@ -138,6 +138,11 @@ func resourceFortiadcLoadbalanceVirtualServer() *schema.Resource { Optional: true, Default: false, }, + "transaction_rate_limit": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, }, } } @@ -221,6 +226,7 @@ func resourceFortiadcLoadbalanceVirtualServerCreate(d *schema.ResourceData, m in ErrorMsg: d.Get("error_msg").(string), ErrorPage: d.Get("error_page").(string), TrafficLog: boolToEnable(d.Get("traffic_log").(bool)), + TransRateLimit: fmt.Sprintf("%d", d.Get("transaction_rate_limit").(int)), } err := client.LoadbalanceCreateVirtualServer(req) @@ -307,6 +313,12 @@ func resourceFortiadcLoadbalanceVirtualServerRead(d *schema.ResourceData, m inte } arguments["connection_limit"] = connectionLimit + transactionRateLimit, err := strconv.ParseInt(rs.TransRateLimit, 10, 64) + if err != nil { + return err + } + arguments["transaction_rate_limit"] = transactionRateLimit + connectionRateLimit, err := strconv.ParseInt(rs.ConnectionRateLimit, 10, 64) if err != nil { return err @@ -399,6 +411,7 @@ func resourceFortiadcLoadbalanceVirtualServerUpdate(d *schema.ResourceData, m in ErrorMsg: d.Get("error_msg").(string), ErrorPage: d.Get("error_page").(string), TrafficLog: boolToEnable(d.Get("traffic_log").(bool)), + TransRateLimit: fmt.Sprintf("%d", d.Get("transaction_rate_limit").(int)), } err := client.LoadbalanceUpdateVirtualServer(req)