Skip to content

azurerm_site_recovery_replicated_vm - remove ForceNew from managed_disk disk type fields#32158

Open
ziyeqf wants to merge 24 commits into
hashicorp:mainfrom
ziyeqf:fix/asr-disk-type-forcenew
Open

azurerm_site_recovery_replicated_vm - remove ForceNew from managed_disk disk type fields#32158
ziyeqf wants to merge 24 commits into
hashicorp:mainfrom
ziyeqf:fix/asr-disk-type-forcenew

Conversation

@ziyeqf

@ziyeqf ziyeqf commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

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

The Azure REST API supports in-place updates to these fields via A2AVMManagedDiskUpdateDetails, and the provider's Update function already constructs the correct update payloads.
Thus we can remove the ForceNew from managed_disk and disk_type

Changing the managed_disk from TypeSet to TypeList, because previously, we only use disk_id to generate the hash of managed_disk, however, to allow in-place update for target_disk_type we have to include these in the hash function of this managed_disk block, otherwise changes on target_disk_type will be droped.
In that case, at creation, the disk_id is unknown, then the managed_disk will become computed, so d.Get() cannot read the value of it, which will cause the creaton fails.
So changing it to a ordered list (since the service does not gurantee the order) makes it clear.

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)
image

Change Log

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

  • azurerm_site_recovery_replicated_vm - remove ForceNew from managed_disk disk type fields [GH-00000]

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 #0000

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

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.

@github-actions github-actions Bot added size/XL and removed size/M labels May 6, 2026
@ziyeqf ziyeqf force-pushed the fix/asr-disk-type-forcenew branch from 613c496 to 972469f Compare June 19, 2026 12:04

@gerrytan gerrytan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you @ziyeqf , I left 1 question and final acctest check. Other than these the PR looks good. Thanks for investigating / explaining the complexity of HashSet over DM.

I triggered another acctest run:

}

for _, field := range []string{"staging_storage_account_id", "target_resource_group_id", "target_disk_encryption_set_id"} {
if siteRecoveryReplicatedVMManagedDiskValue(oldDisk, field) != siteRecoveryReplicatedVMManagedDiskValue(newDisk, field) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this comparison be case-insensitive too since you added DiffSuppressFunc: suppress.CaseDifference, to the schema above?

@ziyeqf ziyeqf marked this pull request as ready for review June 25, 2026 03:11
@ziyeqf ziyeqf requested review from a team, WodansSon and magodo as code owners June 25, 2026 03:11
@hc-github-team-tf-azure

This comment has been minimized.

@hc-github-team-tf-azure

This comment has been minimized.

@gerrytan gerrytan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing the feedbacks @ziyeqf . I've also checked the acctest results and the failures look unrelated to this change. This PR looks good to me.

@ziyeqf ziyeqf requested a review from teowa June 26, 2026 01:19
@hc-github-team-tf-azure

This comment has been minimized.

@hc-github-team-tf-azure hc-github-team-tf-azure added the teamcity-failed Failures in teamcity tests, requires explanation or fixing label Jul 9, 2026
@github-actions github-actions Bot added the teamcity-outdated A new commit has happened since the last teamcity run label Jul 10, 2026
@ziyeqf

This comment has been minimized.

@hc-github-team-tf-azure

Copy link
Copy Markdown
Collaborator

@ziyeqf - One or more tests failed in this PR. Please review the failures.

Build: 702295
PR: #32158

Total: 16
Passed: 13
Failed: 3
Test Duration: 3h 16m 6s

Test Details
StatusTest NameDuration
❌ FAILTestAccSiteRecoveryReplicatedVm_withEdgeZones799.004s
✅ PASSTestAccSiteRecoveryReplicatedVm_zone2zone2800.046s
✅ PASSTestAccSiteRecoveryReplicatedVm_zone2zoneWithLoadBalancerBackendPool2854.183s
✅ PASSTestAccSiteRecoveryReplicatedVm_withTFOSettings2896.048s
✅ PASSTestAccSiteRecoveryReplicatedVm_withProximityPlacementGroup2928.82s
✅ PASSTestAccSiteRecoveryReplicatedVm_withAvailabilitySet2976.958s
✅ PASSTestAccSiteRecoveryReplicatedVm_updateDiskType3376.572s
✅ PASSTestAccSiteRecoveryReplicatedVm_targetDiskEncryption3491.984s
✅ PASSTestAccSiteRecoveryReplicatedVm_basic3514.387s
✅ PASSTestAccSiteRecoveryReplicatedVm_withVMSS3613.682s
✅ PASSTestAccSiteRecoveryReplicatedVm_targetVirtualMachineSize3866.474s
✅ PASSTestAccSiteRecoveryReplicatedVm_withCapacityReservationGroup4064.165s
✅ PASSTestAccSiteRecoveryReplicatedVm_withMultiVmGroup4142.181s
✅ PASSTestAccSiteRecoveryReplicatedVm_withBootDiagStorageAccount4194.979s
❌ FAILTestAccSiteRecoveryReplicatedVm_des11666.006s
❌ FAILTestAccSiteRecoveryReplicatedVm_withUnManagedDisks11669.685s

@hc-github-team-tf-azure hc-github-team-tf-azure removed the teamcity-outdated A new commit has happened since the last teamcity run label Jul 10, 2026
@hc-github-team-tf-azure

Copy link
Copy Markdown
Collaborator

@ziyeqf - One or more tests failed in this PR. Please review the failures.

Testing in Beta version enabled

Build: 702296
PR: #32158

Total: 16
Passed: 13
Failed: 3
Test Duration: 3h 26m 19s

Test Details
StatusTest NameDuration
❌ FAILTestAccSiteRecoveryReplicatedVm_withEdgeZones709.484s
❌ FAILTestAccSiteRecoveryReplicatedVm_withUnManagedDisks752.376s
✅ PASSTestAccSiteRecoveryReplicatedVm_zone2zone2762.787s
✅ PASSTestAccSiteRecoveryReplicatedVm_zone2zoneWithLoadBalancerBackendPool2825.873s
✅ PASSTestAccSiteRecoveryReplicatedVm_withTFOSettings2941.479s
✅ PASSTestAccSiteRecoveryReplicatedVm_withCapacityReservationGroup2982.036s
✅ PASSTestAccSiteRecoveryReplicatedVm_withMultiVmGroup3032.744s
✅ PASSTestAccSiteRecoveryReplicatedVm_basic3511.183s
✅ PASSTestAccSiteRecoveryReplicatedVm_targetDiskEncryption3515.085s
✅ PASSTestAccSiteRecoveryReplicatedVm_withProximityPlacementGroup3544.214s
✅ PASSTestAccSiteRecoveryReplicatedVm_withVMSS3570.492s
✅ PASSTestAccSiteRecoveryReplicatedVm_withAvailabilitySet3578.348s
✅ PASSTestAccSiteRecoveryReplicatedVm_withBootDiagStorageAccount3654.352s
✅ PASSTestAccSiteRecoveryReplicatedVm_targetVirtualMachineSize3841.752s
✅ PASSTestAccSiteRecoveryReplicatedVm_updateDiskType4461.425s
❌ FAILTestAccSiteRecoveryReplicatedVm_des11698.33s

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants