Skip to content

Commit

Permalink
Fix currentStack is being reset when other site_config values are cha…
Browse files Browse the repository at this point in the history
…nged. (hashicorp#18568)

Co-authored-by: KangDroid <kangdroid@outlook.com>
  • Loading branch information
2 people authored and favoretti committed Jan 12, 2023
1 parent 4c1c37f commit 704341b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions internal/services/appservice/helpers/web_app_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -2886,10 +2886,14 @@ func ExpandSiteConfigWindows(siteConfig []SiteConfigWindows, existing *web.SiteC
expanded = existing
}

currentStack := ""

winSiteConfig := siteConfig[0]

currentStack := ""
if len(winSiteConfig.ApplicationStack) == 1 {
winAppStack := winSiteConfig.ApplicationStack[0]
currentStack = winAppStack.CurrentStack
}

if servicePlan.Sku != nil && servicePlan.Sku.Name != nil {
if isFreeOrSharedServicePlan(*servicePlan.Sku.Name) {
if winSiteConfig.AlwaysOn == true {
Expand Down
7 changes: 6 additions & 1 deletion internal/services/appservice/helpers/web_app_slot_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,14 @@ func ExpandSiteConfigWindowsWebAppSlot(siteConfig []SiteConfigWindowsWebAppSlot,
expanded = existing
}

winSlotSiteConfig := siteConfig[0]

currentStack := ""

winSlotSiteConfig := siteConfig[0]
if len(winSlotSiteConfig.ApplicationStack) == 1 {
winAppStack := winSlotSiteConfig.ApplicationStack[0]
currentStack = winAppStack.CurrentStack
}

if metadata.ResourceData.HasChange("site_config.0.always_on") {
expanded.AlwaysOn = utils.Bool(winSlotSiteConfig.AlwaysOn)
Expand Down

0 comments on commit 704341b

Please sign in to comment.