Skip to content

Commit

Permalink
Merge pull request #1510 from stack72/app_gateway_probe_min_servers
Browse files Browse the repository at this point in the history
resource/application_Gateway: Add minimum_servers to probe resource
  • Loading branch information
katbyte committed Jul 7, 2018
2 parents 3801457 + 3e80f00 commit f1b5901
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions azurerm/resource_arm_application_gateway.go
Expand Up @@ -458,6 +458,12 @@ func resourceArmApplicationGateway() *schema.Resource {
Required: true,
},

"minimum_servers": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
},

"match": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -1172,6 +1178,7 @@ func expandApplicationGatewayProbes(d *schema.ResourceData) *[]network.Applicati
interval := int32(data["interval"].(int))
timeout := int32(data["timeout"].(int))
unhealthyThreshold := int32(data["unhealthy_threshold"].(int))
minServers := int32(data["minimum_servers"].(int))

setting := network.ApplicationGatewayProbe{
Name: &name,
Expand All @@ -1182,6 +1189,7 @@ func expandApplicationGatewayProbes(d *schema.ResourceData) *[]network.Applicati
Interval: &interval,
Timeout: &timeout,
UnhealthyThreshold: &unhealthyThreshold,
MinServers: &minServers,
},
}

Expand Down Expand Up @@ -1648,6 +1656,10 @@ func flattenApplicationGatewayProbes(input *[]network.ApplicationGatewayProbe) [
settings["unhealthy_threshold"] = int(*threshold)
}

if minServers := props.MinServers; minServers != nil {
settings["minimum_servers"] = int(*minServers)
}

if match := props.Match; match != nil {
matchConfig := map[string]interface{}{}
if body := match.Body; body != nil {
Expand Down
1 change: 1 addition & 0 deletions azurerm/resource_arm_application_gateway_test.go
Expand Up @@ -1498,6 +1498,7 @@ resource "azurerm_application_gateway" "test" {
timeout = 120
interval = 300
unhealthy_threshold = 8
minimum_servers = 2
match = {
body = "*"
status_code = [
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/application_gateway.html.markdown
Expand Up @@ -262,6 +262,8 @@ The `probe` block supports:

* `unhealthy_threshold` - (Required) Probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Minimum 1 second and Maximum 20.

* `minimum_servers` - (Optional) Minimum number of servers that are always marked healthy. Default value is 0.

* `match` - (Optional) Probe health response match.

* `body` - (Optional) Body that must be contained in the health response. Defaults to "*"
Expand Down

0 comments on commit f1b5901

Please sign in to comment.