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.52k stars 4.6k forks source link

azurerm_machine_learning_compute_cluster re-creates every time unless vm_size is in uppercase #17562

Open jamescrowley opened 2 years ago

jamescrowley commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

v1.2.4

AzureRM Provider Version

v3.10.0

Affected Resource(s)/Data Source(s)

azurerm_machine_learning_compute_cluster

Terraform Configuration Files

resource "azurerm_machine_learning_compute_cluster" "aml" {

  name     = "aml-cluster"
  location = azurerm_resource_group.aml.location
  vm_priority                   = "LowPriority"
  vm_size                       = "STANDARD_NC8AS_T4_v3" # doesn't happen if you upper-case v3 to V3
  machine_learning_workspace_id = azurerm_machine_learning_workspace.aml.id
  subnet_resource_id            = azurerm_subnet.aml.id

  scale_settings {
    min_node_count                       = 0
    max_node_count                       = 3
    scale_down_nodes_after_idle_duration = "PT30S" # 30 seconds
  }

  identity {
    type = "SystemAssigned"
  }
}

Debug Output/Panic Output

Output from terraform plan:

# azurerm_machine_learning_compute_cluster.aml["cluster-gpu2"] must be replaced
127
-/+ resource "azurerm_machine_learning_compute_cluster" "aml" {
128
~id                            = "/subscriptions/***/resourceGroups/dataprocessing-aml/providers/Microsoft.MachineLearningServices/workspaces/aml-mlw/computes/aml-cluster-gpu2" ->(known after apply)
129
name                          = "aml-cluster-gpu2"
130
~ssh_public_access_enabled     = false ->(known after apply)
131
-tags                          = {} ->null
132
~vm_size                       = "STANDARD_NC8AS_T4_V3" ->"STANDARD_NC8AS_T4_v3" # forces replacement
133
# (5 unchanged attributes hidden)
134
135
~identity {
136
-identity_ids = [] ->null
137
~principal_id = "a2757b80-0625-42af-a3d9-f60bad5d6b78" ->(known after apply)
138
~tenant_id    = "***" ->(known after apply)
139
# (1 unchanged attribute hidden)
140
        }
141
142
# (1 unchanged block hidden)
143
    }
144

Expected Behaviour

Shouldn't re-create cluster just because the casing is different

Actual Behaviour

Cluster is re-created

Steps to Reproduce

No response

Important Factoids

No response

References

No response

sinbai commented 2 years ago

@jamescrowley thank you for opening this issue here. After checking the behavior of Azure API, when setting the value of vmSize to STANDARD_NC8AS_T4_v3, the Azure API returns STANDARD_NC8AS_T4_V3 instead of STANDARD_NC8AS_T4_v3. This is the root cause of the resource being recreated. I have filed an Azure API issue . Could you follow it for more updates?