Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing azurerm_managed_disk disk tags causes VM reboot #6063

Closed
shurikk opened this issue Mar 11, 2020 · 1 comment · Fixed by #6162
Closed

changing azurerm_managed_disk disk tags causes VM reboot #6063

shurikk opened this issue Mar 11, 2020 · 1 comment · Fixed by #6162

Comments

@shurikk
Copy link
Contributor

shurikk commented Mar 11, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.12.21

  • provider.azurerm v1.44.0

Affected Resource(s)

  • azurerm_managed_disk

Terraform Configuration Files

data "azurerm_resource_group" "rg" {
  name = "<RESOURCE_GROUP_NAME>"
}

resource "azurerm_network_interface" "vm1234-nic" {
  name                = "vm1234-nic"
  location            = data.azurerm_resource_group.rg.location
  resource_group_name = data.azurerm_resource_group.rg.name

  ip_configuration {
    name                          = "vm1234-ip"
    subnet_id = "<SUBNET_ID>"
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_managed_disk" "vm1234_data_disk_1" {
  location             = data.azurerm_resource_group.rg.location
  resource_group_name  = data.azurerm_resource_group.rg.name

  name  = "vm1234_data_disk_1"
  storage_account_type = "Standard_LRS"
  disk_size_gb         = "32"
  create_option        = "Empty"
  tags = {
    "tag1" = "value1"
    #"tag2" = "value2"
  }
}

resource "azurerm_virtual_machine" "vm1234" {
  name                  = "vm1234"
  resource_group_name   = data.azurerm_resource_group.rg.name
  location = data.azurerm_resource_group.rg.location
  network_interface_ids = [azurerm_network_interface.vm1234-nic.id]
  vm_size               = "Standard_B1ls"

  storage_os_disk {
    name              = "vm1234-disk"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Premium_LRS"
  }

  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04.0-LTS"
    version   = "latest"
  }

  os_profile {
    computer_name  = "vm1234"
    admin_username = "<REDACTED>"
    admin_password = "<REDACTED>"
  }

  os_profile_linux_config {
    disable_password_authentication = false
  }

  storage_data_disk {
    name = "vm1234_data_disk_1"
    caching = "ReadWrite"
    lun = 0
    disk_size_gb = "32"
    create_option   = "Attach"
    managed_disk_id = azurerm_managed_disk.vm1234_data_disk_1.id
  }
}

Debug Output

...
2020-03-11T00:54:31.620-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: [DEBUG] Shutting Down Virtual Machine "vm1234" (Resource Group "rg")..
2020-03-11T00:54:31.620-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: [DEBUG] AzureRM Request: 
2020-03-11T00:54:31.620-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: POST /subscriptions/UUID/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1234/powerOff?api-version=2019-07-01&skipShutdown=false HTTP/1.1
2020-03-11T00:54:31.620-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Host: management.az
...

Expected Behavior

changing tags on a managed disk should not trigger VM reboot

Actual Behavior

VM is rebooted unexpectedly

Steps to Reproduce

  1. terraform apply
  2. uncomment tag2
  3. terraform apply watch VM rebooting, inspect VM activity log

References

@ghost
Copy link

ghost commented Apr 24, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants