hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.46k stars 4.54k forks source link

Changing azurerm_machine_learning_workspace.image_build_compute_name forces replacement of the workspace #25622

Open zhusulai opened 2 months ago

zhusulai commented 2 months ago

Is there an existing issue for this?

Community Note

Terraform Version

0.11

AzureRM Provider Version

2.93.1

Affected Resource(s)/Data Source(s)

azurerm_machine_learning_workspace

Terraform Configuration Files

resource "azurerm_machine_learning_workspace" "azml_workspace" {
  name     = "myworkspace"
  location = "eastus2"
  resource_group_name      = "myRG"
  key_vault_id             = azurerm_key_vault.azml_kv.id
  storage_account_id       = azurerm_storage_account.azml_st.id
  container_registry_id    = azurerm_container_registry.azml_acr.id
  high_business_impact     = true
  image_build_compute_name = "ACR-TASKS-FALLBACK"
  identity {
    type = "SystemAssigned"
  }
}

Debug Output/Panic Output

n/a

Expected Behaviour

image_build_compute_name can be set by using Azure CLI without having to destroy and recreate the workspace. Terraform should patch the workspace and set the property based on the config provided.

Actual Behaviour

Terraform tries to destroy and recreate the workspace. If the workspace has soft-delete enabled, the recreation will fail, resulting in missing workspaces.

Official documentation also do not mention changing the property will force a replacement. https://registry.terraform.io/providers/hashicorp/azurerm/2.93.1/docs/resources/machine_learning_workspace.html#image_build_compute_name

Steps to Reproduce

change the image_build_compute_name property run terraform apply

Important Factoids

No response

References

No response

rcskosir commented 2 months ago

Thanks for taking the time to open this issue. You have written that this issue is in the 2.x version of the provider which is no longer actively maintained. Are you able to upgrade and let us know if this is occurs on the latest provider (3.99 as of writing this)?

xuzhang3 commented 2 months ago

@zhusulai the image_build_compute_name will not trigger a recreate operation, can you check the terraform plan which property triggers the recreation, the output log should show the details.

amoresi1-mc commented 2 months ago

@xuzhang3 Output from terraform plan - image_build_compute_name = "ACR-TASKS-FALLBACK" -> null # forces replacement

xuzhang3 commented 2 months ago

@amoresi1-mc The ForceNew in image_build_compute_name has been removed in the latest release. Are you able to upgrade AzureRM version?