Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaxyi committed Nov 9, 2022
1 parent cff8ae1 commit 705f9b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions internal/services/appservice/linux_function_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,18 +751,19 @@ func (r LinuxFunctionAppResource) Update() sdk.ResourceFunc {
existing.SiteProperties.ServerFarmID = utils.String(serviceFarmId)
}

_, planSku, err := helpers.ServicePlanInfoForApp(ctx, metadata, *id)

_, updatedPlanSKU, err := helpers.GetServicePlanSku(ctx, metadata, *id, serviceFarmId)
_, planSKU, err := helpers.GetServicePlanSku(ctx, metadata, *id, serviceFarmId)
if err != nil {
return err
}

if updatedPlanSKU != nil {
planSku = updatedPlanSKU
if planSKU == nil {
_, planSKU, err = helpers.ServicePlanInfoForApp(ctx, metadata, *id)
if err != nil {
return err
}
}
// Only send for ElasticPremium and consumption plan
sendContentSettings := (helpers.PlanIsConsumption(planSku) || helpers.PlanIsElastic(planSku)) && !state.ForceDisableContentShare
sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !state.ForceDisableContentShare

if metadata.ResourceData.HasChange("enabled") {
existing.SiteProperties.Enabled = utils.Bool(state.Enabled)
Expand Down
13 changes: 7 additions & 6 deletions internal/services/appservice/windows_function_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,18 +749,19 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc {
existing.SiteProperties.ServerFarmID = utils.String(serviceFarmId)
}

_, planSku, err := helpers.ServicePlanInfoForApp(ctx, metadata, *id)

_, updatedPlanSKU, err := helpers.GetServicePlanSku(ctx, metadata, *id, serviceFarmId)
_, planSKU, err := helpers.GetServicePlanSku(ctx, metadata, *id, serviceFarmId)
if err != nil {
return err
}

if updatedPlanSKU != nil {
planSku = updatedPlanSKU
if planSKU == nil {
_, planSKU, err = helpers.ServicePlanInfoForApp(ctx, metadata, *id)
if err != nil {
return err
}
}
// Only send for ElasticPremium and consumption plan
sendContentSettings := (helpers.PlanIsConsumption(planSku) || helpers.PlanIsElastic(planSku)) && !state.ForceDisableContentShare
sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !state.ForceDisableContentShare

// Some service plan updates are allowed - see customiseDiff for exceptions
if metadata.ResourceData.HasChange("service_plan_id") {
Expand Down

0 comments on commit 705f9b0

Please sign in to comment.