Skip to content

Commit

Permalink
resource/application_Gateway: Add minimum_servers to probe resource
Browse files Browse the repository at this point in the history
This was missing from the original implementation and is required if
you want to manually mark servers as active
  • Loading branch information
stack72 committed Jul 6, 2018
1 parent 3801457 commit 3078e0d
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
Original file line number Diff line number Diff line change
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_healthy"] = 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
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,7 @@ resource "azurerm_application_gateway" "test" {
timeout = 120
interval = 300
unhealthy_threshold = 8
minimum_healthy = 2
match = {
body = "*"
status_code = [
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/application_gateway.html.markdown
Original file line number Diff line number Diff line change
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 3078e0d

Please sign in to comment.