Skip to content

Commit

Permalink
azurerm_[linux|windows]_function_app_slot - fix health_check_evicti…
Browse files Browse the repository at this point in the history
…on_time_in_min (#20816)
  • Loading branch information
jackofallops authored Mar 7, 2023
1 parent e765c73 commit 8961fdd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions internal/services/appservice/helpers/function_app_slot_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func SiteConfigSchemaWindowsFunctionAppSlot() *pluginsdk.Schema {
"health_check_eviction_time_in_min": { // NOTE: Will evict the only node in single node configurations.
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
Default: 0,
ValidateFunc: validation.IntBetween(2, 10),
Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Defaults to `10`. Only valid in conjunction with `health_check_path`",
},
Expand Down Expand Up @@ -572,7 +572,7 @@ func SiteConfigSchemaLinuxFunctionAppSlot() *pluginsdk.Schema {
"health_check_eviction_time_in_min": { // NOTE: Will evict the only node in single node configurations.
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
Default: 0,
ValidateFunc: validation.IntBetween(2, 10),
Description: "The amount of time in minutes that a node is unhealthy before being removed from the load balancer. Possible values are between `2` and `10`. Defaults to `10`. Only valid in conjunction with `health_check_path`",
},
Expand Down Expand Up @@ -669,10 +669,11 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti
if metadata.ResourceData.HasChange("site_config.0.health_check_path") {
if windowsSlotSiteConfig.HealthCheckPath != "" && metadata.ResourceData.HasChange("site_config.0.health_check_eviction_time_in_min") {
v := strconv.Itoa(windowsSlotSiteConfig.HealthCheckEvictionTime)
appSettings = append(appSettings, web.NameValuePair{
Name: utils.String("WEBSITE_HEALTHCHECK_MAXPINGFAILURES"),
Value: utils.String(v),
})
if v == "0" {
appSettings = updateOrAppendAppSettings(appSettings, "WEBSITE_HEALTHCHECK_MAXPINGFAILURES", v, true)
} else {
appSettings = updateOrAppendAppSettings(appSettings, "WEBSITE_HEALTHCHECK_MAXPINGFAILURES", v, false)
}
}
}

Expand Down Expand Up @@ -963,10 +964,11 @@ func ExpandSiteConfigLinuxFunctionAppSlot(siteConfig []SiteConfigLinuxFunctionAp
if metadata.ResourceData.HasChange("site_config.0.health_check_path") {
if linuxSlotSiteConfig.HealthCheckPath != "" && metadata.ResourceData.HasChange("site_config.0.health_check_eviction_time_in_min") {
v := strconv.Itoa(linuxSlotSiteConfig.HealthCheckEvictionTime)
appSettings = append(appSettings, web.NameValuePair{
Name: utils.String("WEBSITE_HEALTHCHECK_MAXPINGFAILURES"),
Value: utils.String(v),
})
if v == "0" {
appSettings = updateOrAppendAppSettings(appSettings, "WEBSITE_HEALTHCHECK_MAXPINGFAILURES", v, true)
} else {
appSettings = updateOrAppendAppSettings(appSettings, "WEBSITE_HEALTHCHECK_MAXPINGFAILURES", v, false)
}
}
}

Expand Down

0 comments on commit 8961fdd

Please sign in to comment.