Skip to content

Commit

Permalink
Add comment parameter to loadbalancer_virtual_server (#64)
Browse files Browse the repository at this point in the history
* Add comments parameter to loadbalancer_virtual_server
  • Loading branch information
tmarshall98 authored Aug 8, 2022
1 parent cb8ae9e commit 4991a65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/loadbalance_virtual_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "fortiadc_loadbalance_virtual_server" "myvirtualserver" {
* `error_page` - (Optional) Error page on backend failure.
* `persistence` - (Optional) Persistence configuration.
* `transaction_rate_limit` - (Optional) Limit of transactions per second. Defaults to `0`.
* `comments` - (Optional) Set the comment field on the resource.

## Attribute Reference

Expand Down
8 changes: 8 additions & 0 deletions fortiadc/resource_fortiadc_loadbalance_virtual_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func resourceFortiadcLoadbalanceVirtualServer() *schema.Resource {
Required: true,
ForceNew: true,
},
"comments": {
Type: schema.TypeString,
Required: false,
Optional: true,
},
"status": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -227,6 +232,7 @@ func resourceFortiadcLoadbalanceVirtualServerCreate(d *schema.ResourceData, m in
ErrorPage: d.Get("error_page").(string),
TrafficLog: boolToEnable(d.Get("traffic_log").(bool)),
TransRateLimit: fmt.Sprintf("%d", d.Get("transaction_rate_limit").(int)),
Comments: d.Get("comments").(string),
}

err := client.LoadbalanceCreateVirtualServer(req)
Expand Down Expand Up @@ -299,6 +305,7 @@ func resourceFortiadcLoadbalanceVirtualServerRead(d *schema.ResourceData, m inte
"error_msg": rs.ErrorMsg,
"error_page": rs.ErrorPage,
"traffic_log": enableToBool(rs.TrafficLog),
"comments": rs.Comments,
}

port, err := strconv.ParseInt(strings.TrimSpace(rs.Port), 10, 64)
Expand Down Expand Up @@ -412,6 +419,7 @@ func resourceFortiadcLoadbalanceVirtualServerUpdate(d *schema.ResourceData, m in
ErrorPage: d.Get("error_page").(string),
TrafficLog: boolToEnable(d.Get("traffic_log").(bool)),
TransRateLimit: fmt.Sprintf("%d", d.Get("transaction_rate_limit").(int)),
Comments: d.Get("comments").(string),
}

err := client.LoadbalanceUpdateVirtualServer(req)
Expand Down

0 comments on commit 4991a65

Please sign in to comment.