Skip to content

Commit 5f1d8f6

Browse files
committed
fix: webapp slot default of removed authv2
1 parent 29fde31 commit 5f1d8f6

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

internal/services/appservice/linux_function_app_slot_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,10 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc {
10771077

10781078
if metadata.ResourceData.HasChange("auth_settings_v2") {
10791079
authV2Update := helpers.ExpandAuthV2Settings(state.AuthV2Settings)
1080+
// (@toddgiguere) - in the case of a removal of this block, we need to zero these settings
1081+
if authV2Update.Properties == nil {
1082+
authV2Update.Properties = helpers.DefaultAuthV2SettingsProperties()
1083+
}
10801084
if _, err := client.UpdateAuthSettingsV2Slot(ctx, *id, *authV2Update); err != nil {
10811085
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", id, err)
10821086
}

internal/services/appservice/linux_web_app_slot_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,10 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc {
891891

892892
if metadata.ResourceData.HasChange("auth_settings_v2") {
893893
authV2Update := helpers.ExpandAuthV2Settings(state.AuthV2Settings)
894+
// (@toddgiguere) - in the case of a removal of this block, we need to zero these settings
895+
if authV2Update.Properties == nil {
896+
authV2Update.Properties = helpers.DefaultAuthV2SettingsProperties()
897+
}
894898
if _, err := client.UpdateAuthSettingsV2Slot(ctx, *id, *authV2Update); err != nil {
895899
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", id, err)
896900
}

internal/services/appservice/windows_function_app_slot_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,10 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc {
10931093

10941094
if metadata.ResourceData.HasChange("auth_settings_v2") {
10951095
authV2Update := helpers.ExpandAuthV2Settings(state.AuthV2Settings)
1096+
// (@toddgiguere) - in the case of a removal of this block, we need to zero these settings
1097+
if authV2Update.Properties == nil {
1098+
authV2Update.Properties = helpers.DefaultAuthV2SettingsProperties()
1099+
}
10961100
if _, err := client.UpdateAuthSettingsV2Slot(ctx, *id, *authV2Update); err != nil {
10971101
return fmt.Errorf("updating AuthV2 Settings for Windows %s: %+v", id, err)
10981102
}

internal/services/appservice/windows_web_app_slot_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,10 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc {
974974

975975
if metadata.ResourceData.HasChange("auth_settings_v2") {
976976
authV2Update := helpers.ExpandAuthV2Settings(state.AuthV2Settings)
977+
// (@toddgiguere) - in the case of a removal of this block, we need to zero these settings
978+
if authV2Update.Properties == nil {
979+
authV2Update.Properties = helpers.DefaultAuthV2SettingsProperties()
980+
}
977981
if _, err := client.UpdateAuthSettingsV2Slot(ctx, *id, *authV2Update); err != nil {
978982
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", *id, err)
979983
}

0 commit comments

Comments
 (0)