Skip to content

[AVM Module Issue]: 409 Conflict on migrated VM import #240

@mikedembek

Description

@mikedembek

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

Bug

(Optional) Module Version

0.20.0

(Optional) Correlation Id

No response

Description

I have some VMs that were migrated to Azure from on-prem VMware. I originally had issues with importing these similar to the issue described in #230, which were resolved when I pinned the commit in #234. After that, however, I got a new error:

│ Error: updating Windows Virtual Machine (Subscription: "my-sub-id"
│ Resource Group Name: "rg-example"
│ Virtual Machine Name: "vm-example03"): performing Update: unexpected status 409 (409 Conflict) with error: PropertyChangeNotAllowed: Changing property 'osProfile' is not allowed.
│ 
│   with module.example03[0].azurerm_windows_virtual_machine.this[0],
│   on .terraform/modules/example03/main.windows_vm.tf line 1, in resource "azurerm_windows_virtual_machine" "this":
│    1: resource "azurerm_windows_virtual_machine" "this" {
│ 

That was related to two items in the plan (the only changes/additions):

  # module.example03[0].azurerm_windows_virtual_machine.this[0] will be updated in-place
  # (imported from "/subscriptions/my-sub-id/resourceGroups/rg-example/providers/Microsoft.Compute/virtualMachines/vm-example03")
  ~ resource "azurerm_windows_virtual_machine" "this" {
      + allow_extension_operations                             = true
      + bypass_platform_safety_checks_on_user_schedule_enabled = false
        #etc.

This only occurs one time on apply, subsequent plan/apply operations seem fine with no drift detected.

I believe the issue is that these attributes are immutable and cannot be set post-creation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions