Skip to content

Commit

Permalink
windows_web_app_(slot)_resource: Fix currentStack is not fetched from…
Browse files Browse the repository at this point in the history
… state when updating infrastructure using terraform. (#17490)
  • Loading branch information
KangDroid authored Jul 8, 2022
1 parent b8fe62a commit 675c152
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/services/appservice/windows_web_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,11 @@ func (r WindowsWebAppResource) Update() sdk.ResourceFunc {
}

currentStack := ""
stateConfig := state.SiteConfig[0]
if len(stateConfig.ApplicationStack) == 1 {
currentStack = stateConfig.ApplicationStack[0].CurrentStack
}

if metadata.ResourceData.HasChange("site_config") {
siteConfig, stack, err := helpers.ExpandSiteConfigWindows(state.SiteConfig, existing.SiteConfig, metadata)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions internal/services/appservice/windows_web_app_slot_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc {
}

currentStack := ""
stateConfig := state.SiteConfig[0]
if len(stateConfig.ApplicationStack) == 1 {
currentStack = stateConfig.ApplicationStack[0].CurrentStack
}

if metadata.ResourceData.HasChange("site_config") {
siteConfig, stack, err := helpers.ExpandSiteConfigWindowsWebAppSlot(state.SiteConfig, existing.SiteConfig, metadata)
if err != nil {
Expand Down

0 comments on commit 675c152

Please sign in to comment.