I have a azure infra created using terraform using a count variable with count as 2, so it creates two VMs with disks and disk encryption also applied, but when I increase the VM count by increasing the count to 3, it works according to my script by creating a 3rd VM and its dependent resources but it also again recreates the data disk of other two VMs I. vm1 & vm2. in terraform plan it shows the encryption forces replacement.
attached below plan.
azurerm_managed_disk.externalweb[0] must be replaced
-/+ resource “azurerm_managed_disk” “externalweb” {
create_option = “Empty”
~ disk_iops_read_write = 500 -> (known after apply)
~ disk_mbps_read_write = 60 -> (known after apply)
disk_size_gb = 10
~ id = “/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” -> (known after apply)
location = “eastus”
name = “WEBVM1”
resource_group_name = “GCH_INTEGDEV_EUSrg2”
- source_uri = (known after apply)
storage_account_type = “Standard_LRS”
~ tags = {} -> (known after apply)
-
zones = -> null
-
encryption_settings {
-
enabled = true -> null # forces replacement
can anyone suggest me how can I rid the replacement/re-creation of my data disk again everytime I scale out & in the infra.