Skip to content

azurerm_service_plan : allow update zone_balancing_enabled property without ForceNew#29810

Merged
sreallymatt merged 5 commits intohashicorp:mainfrom
sinbai:web/fix_29758
Jul 7, 2025
Merged

azurerm_service_plan : allow update zone_balancing_enabled property without ForceNew#29810
sreallymatt merged 5 commits intohashicorp:mainfrom
sinbai:web/fix_29758

Conversation

@sinbai
Copy link
Contributor

@sinbai sinbai commented Jun 5, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

  1. Allow conditional update of "zone_balancing_enabled" property without using "ForceNew".
  2. Due to the quota limitations of the Premium SKU tier, the location is hardcoded in the test codeTestAccServicePlan_completeUpdate.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Test Results:
image

https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_APPSERVICE/406223?buildTab=tests&expandedTest=build%3A%28id%3A406223%29%2Cid%3A2000000000

image

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #29758

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@sinbai sinbai marked this pull request as ready for review June 10, 2025 09:28
@sinbai sinbai requested a review from a team as a code owner June 10, 2025 09:28
Copy link
Collaborator

@sreallymatt sreallymatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sinbai, the azurerm_app_service_plan has been deprecated for quite some time, the deprecation message mentions it is feature frozen, as such I don't think we should be adding this change.

Instead, we should update azurerm_service_plan, I'm not too familiar with this specific resource but quickly looking at it, I believe the property we'll want to look at is zone_balancing_enabled

@sinbai sinbai force-pushed the web/fix_29758 branch 2 times, most recently from 15e4284 to 62f334f Compare June 30, 2025 07:35
B
update code
@sinbai sinbai changed the title azurerm_app_service_plan : allow update zone_redundant property without ForceNew azurerm_service_plan : allow update zone_balancing_enabled property without ForceNew Jun 30, 2025
@sinbai
Copy link
Contributor Author

sinbai commented Jun 30, 2025

Hi @sinbai, the azurerm_app_service_plan has been deprecated for quite some time, the deprecation message mentions it is feature frozen, as such I don't think we should be adding this change.

Instead, we should update azurerm_service_plan, I'm not too familiar with this specific resource but quickly looking at it, I believe the property we'll want to look at is zone_balancing_enabled

Hi @sreallymatt thank you very much for your feedback. The code has been updated — could you please take another look?

Copy link
Collaborator

@sreallymatt sreallymatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes @sinbai, one minor comment, and could you run make terrafmt to resolve the failing GHA? Once that's done this should be good to go!

@sreallymatt
Copy link
Collaborator

We've also got a test failure on the data source, could you update it as well?

TestAccServicePlanDataSource_complete: Attribute 'location' expected "eastus2", got "eastasia"

@sinbai
Copy link
Contributor Author

sinbai commented Jul 7, 2025

We've also got a test failure on the data source, could you update it as well?

TestAccServicePlanDataSource_complete: Attribute 'location' expected "eastus2", got "eastasia"

Hi @sreallymatt thanks for your feedback earlier. The test case is now passing - would you mind reviewing it again when convenient? Much appreciated!

image

Copy link
Collaborator

@sreallymatt sreallymatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sinbai, LGTM! ✅

@sreallymatt sreallymatt merged commit 08a5b92 into hashicorp:main Jul 7, 2025
34 checks passed
zoneBalancing := rd.Get("zone_balancing_enabled").(bool)
if zoneBalancing {
if !strings.HasPrefix(servicePlanSku, "P") {
return fmt.Errorf("`zone_balancing_enabled` cannot be set to `true` when sku tier is not Premium")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caused #30149

Copy link
Contributor

@timja timja Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FlexConsumption (FC1) also supports this

Example from our app service plan:

    "sku": {
        "name": "FC1",
        "tier": "FlexConsumption",
        "size": "FC1",
        "family": "FC",
        "capacity": 0
    },
   "zoneRedundant": true,

@github-actions
Copy link
Contributor

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.