azurerm_service_plan - support for premium_plan_auto_scale_enabled#28524
azurerm_service_plan - support for premium_plan_auto_scale_enabled#28524mbfrahry merged 4 commits intohashicorp:mainfrom
azurerm_service_plan - support for premium_plan_auto_scale_enabled#28524Conversation
mbfrahry
left a comment
There was a problem hiding this comment.
Hey @xiaxyi, this overall looks good but there are a few things I've called out. Mainly that there is duplicate checks curing Create/Update that should be caught by the CustomizeDiff. Did you see something that required those checks to be run at plan and apply time?
Also I'm seeing a test failure
=== CONT TestAccServicePlan_linuxPremiumAutoScaleFeatureUpdate
testcase.go:173: Step 4/9 error: Error running apply: exit status 1
Error: `maximum_elastic_worker_count` can only be specified with Elastic Premium Skus
with azurerm_service_plan.test,
on terraform_plugin_test.tf line 40, in resource "azurerm_service_plan" "test":
40: resource "azurerm_service_plan" "test" {
`maximum_elastic_worker_count` can only be specified with Elastic Premium
Skus
--- FAIL: TestAccServicePlan_linuxPremiumAutoScaleFeatureUpdate (235.71s)```
|
|
||
| if servicePlan.PremiumPlanAutoScaleEnabled { | ||
| if !helpers.PlanIsPremium(&servicePlan.Sku) { | ||
| return fmt.Errorf("`premium_plan_auto_scale_enabled` can only be set for premium app service plan") |
There was a problem hiding this comment.
This is a duplicate of what is in the CustomizeDiff
| if !isServicePlanSupportScaleOut(servicePlan.Sku) { | ||
| return fmt.Errorf("`maximum_elastic_worker_count` can only be specified with Elastic Premium Skus") | ||
| if helpers.PlanIsPremium(&servicePlan.Sku) && !servicePlan.PremiumPlanAutoScaleEnabled { | ||
| return fmt.Errorf("`maximum_elastic_worker_count` can only be specified with Elastic Premium Skus or Premium Skus that has `premium_plan_auto_scale_enabled` set to `true`") |
There was a problem hiding this comment.
This seems to be a duplicate of what is already in the CustomizeDiff. Do we need this check twice?
| return false | ||
| } | ||
|
|
||
| func PlanIsPremium(input *string) bool { |
There was a problem hiding this comment.
Do we have to pass a pointer to a string for this function? It looks like every time we call this function, you're passing in the address of a string when we could just pass the string
| func PlanIsPremium(input *string) bool { | |
| func PlanIsPremium(input string) bool { |
|
|
||
| if metadata.ResourceData.HasChange("premium_plan_auto_scale_enabled") { | ||
| if !helpers.PlanIsPremium(&state.Sku) { | ||
| return fmt.Errorf("`premium_plan_auto_scale_enabled` can only be set for premium app service plan") |
There was a problem hiding this comment.
This also seems like a duplicate of the CustomizeDiff
| ~> **NOTE:** Requires an Isolated SKU. Use one of `I1`, `I2`, `I3` for `azurerm_app_service_environment`, or `I1v2`, `I2v2`, `I3v2` for `azurerm_app_service_environment_v3` | ||
|
|
||
| * `maximum_elastic_worker_count` - (Optional) The maximum number of workers to use in an Elastic SKU Plan. Cannot be set unless using an Elastic SKU. | ||
| * `premium_plan_auto_scale_enabled` - (Optional) Should automatic scaling be enabled for the Premium SKU Plan. Defaults to `false`.Cannot be set unless using a Premium SKU. |
There was a problem hiding this comment.
| * `premium_plan_auto_scale_enabled` - (Optional) Should automatic scaling be enabled for the Premium SKU Plan. Defaults to `false`.Cannot be set unless using a Premium SKU. | |
| * `premium_plan_auto_scale_enabled` - (Optional) Should automatic scaling be enabled for the Premium SKU Plan. Defaults to `false`. Cannot be set unless using a Premium SKU. |
|
@mbfrahry Thanks for the comments, code is updated and tests are passed. The failed tests are irrelevant to the code change. |
| if metadata.ResourceData.HasChange("premium_plan_auto_scale_enabled") { | ||
| if !helpers.PlanIsPremium(&state.Sku) { | ||
| if !helpers.PlanIsPremium(state.Sku) { | ||
| return fmt.Errorf("`premium_plan_auto_scale_enabled` can only be set for premium app service plan") |
There was a problem hiding this comment.
It looks like this comment was missed that we shouldn't need this check as it's in the CustomizeDiff
azurerm_service_plan - support premium service plan auto scale featureazurerm_service_plan - support for premium_plan_auto_scale_enabled
* CHANGELOG.md for v4.19.0 * Update CHANGELOG.md #28523 * Update CHANGELOG.md #28691 * Updated to include #28717 * Update for #26680 * Update CHANGELOG.md #28633 * Update CHANGELOG.md for #28703 * Update CHANGELOG.md for #28391 * Update CHANGELOG.md #28725 * Update #28733 * Update CHANGELOG.md #28659 * Update for #28741 * Update CHANGELOG.md #28712 * Update CHANGELOG.md #28441 * Update CHANGELOG.md #28441 * Update CHANGELOG.md #28441 * Update CHANGELOG.md for #28602 * Update for #27424 * Update CHANGELOG.md for #28524 * Update CHANGELOG.md #28726 * Update for #28767 * Update for #28195 * prep for release v4.19.0 --------- Co-authored-by: sreallymatt <106555974+sreallymatt@users.noreply.github.com> Co-authored-by: Wodans Son <20408400+WodansSon@users.noreply.github.com> Co-authored-by: stephybun <steph@hashicorp.com> Co-authored-by: Wyatt Fry <wyattfry@gmail.com> Co-authored-by: Matthew Frahry <mbfrahry@gmail.com> Co-authored-by: jackofallops <ste@hashicorp.com>
* CHANGELOG.md for v4.19.0 * Update CHANGELOG.md hashicorp#28523 * Update CHANGELOG.md hashicorp#28691 * Updated to include hashicorp#28717 * Update for hashicorp#26680 * Update CHANGELOG.md hashicorp#28633 * Update CHANGELOG.md for hashicorp#28703 * Update CHANGELOG.md for hashicorp#28391 * Update CHANGELOG.md hashicorp#28725 * Update hashicorp#28733 * Update CHANGELOG.md hashicorp#28659 * Update for hashicorp#28741 * Update CHANGELOG.md hashicorp#28712 * Update CHANGELOG.md hashicorp#28441 * Update CHANGELOG.md hashicorp#28441 * Update CHANGELOG.md hashicorp#28441 * Update CHANGELOG.md for hashicorp#28602 * Update for hashicorp#27424 * Update CHANGELOG.md for hashicorp#28524 * Update CHANGELOG.md hashicorp#28726 * Update for hashicorp#28767 * Update for hashicorp#28195 * prep for release v4.19.0 --------- Co-authored-by: sreallymatt <106555974+sreallymatt@users.noreply.github.com> Co-authored-by: Wodans Son <20408400+WodansSon@users.noreply.github.com> Co-authored-by: stephybun <steph@hashicorp.com> Co-authored-by: Wyatt Fry <wyattfry@gmail.com> Co-authored-by: Matthew Frahry <mbfrahry@gmail.com> Co-authored-by: jackofallops <ste@hashicorp.com>
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Community Note
Description
PR Checklist
For example: “
resource_name_here- description of change e.g. adding propertynew_property_name_here”Changes to existing Resource / Data Source
Testing
--- PASS: TestAccServicePlan_completeUpdate (223.57s)
--- PASS: TestAccServicePlan_completeUpdate (223.57s)
--- PASS: TestAccServicePlan_completeUpdate (223.57s)
--- PASS: TestAccServicePlan_maxElasticWorkerCount (230.74s)
--- PASS: TestAccServicePlan_basic (128.02s)
--- PASS: TestAccServicePlan_requiresImport (108.08s)
--- PASS: TestAccServicePlan_linuxFlexConsumption (111.20s)
--- PASS: TestAccServicePlan_linuxConsumption (119.28s)
--- PASS: TestAccServicePlan_linuxPremiumAutoScaleFeatureUpdate (311.50s)
--- PASS: TestAccServicePlanIsolated_appServiceEnvironmentV3 (4023.99s)
FAIL
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_service_plan- support for thepremium_plan_auto_scale_enabledproperty [[azurerm_service_plan] Support for the new Automatic Scaling (currently in preview) #22313]This is a (please select all that apply):
Related Issue(s)
Fixes #22313
Fixes #28358
Note
If this PR changes meaningfully during the course of review please update the title and description as required.