Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_linux_web_app_slot azurerm_linux_web_app - Add length check to avoid potential index out of range panic #21328

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions internal/services/appservice/helpers/linux_web_app_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,16 @@ func expandAutoHealSettingsLinux(autoHealSettings []AutoHealSettingLinux) *web.A

autoHeal := autoHealSettings[0]

if len(autoHeal.Actions) > 0 {
action := autoHeal.Actions[0]
result.Actions.ActionType = web.AutoHealActionType(action.ActionType)
result.Actions.MinProcessExecutionTime = pointer.To(action.MinimumProcessTime)
}

if len(autoHeal.Triggers) == 0 {
return result
}

triggers := autoHeal.Triggers[0]
if len(triggers.Requests) == 1 {
lonegunmanb marked this conversation as resolved.
Show resolved Hide resolved
result.Triggers.Requests = &web.RequestsBasedTrigger{
Expand Down Expand Up @@ -1193,10 +1203,6 @@ func expandAutoHealSettingsLinux(autoHealSettings []AutoHealSettingLinux) *web.A
result.Triggers.StatusCodesRange = &statusCodeRangeTriggers
}

action := autoHeal.Actions[0]
result.Actions.ActionType = web.AutoHealActionType(action.ActionType)
result.Actions.MinProcessExecutionTime = pointer.To(action.MinimumProcessTime)

return result
}

Expand Down
Loading