hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

google_compute_instance > boot_disk > auto_delete update should not force replacement #6892

Open mrzor opened 4 years ago

mrzor commented 4 years ago

Community Note

Terraform Version

Terraform v0.12.29
+ provider.google v3.30.0
+ provider.google-beta v3.30.0

Affected Resource(s)

Terraform Configuration Files

resource "google_compute_instance" "main" {
  project             = google_project.main.project_id
  name                = local.xxx_instance_name
  machine_type        = var.xxx_instance_machine_type
  zone                = var.xxx_instance_zone
  deletion_protection = true

  boot_disk {
    source      = google_compute_disk.main_instance_boot_drive.name
    auto_delete = false
  }

  network_interface {
    # snip
  }

  service_account {
    # snip
  }

  scheduling {
    # snip
  }

  guest_accelerator {
    # snip
  }

  # snip depends_on = [ ... ]
}

Expected Behavior

      ~ boot_disk {
          ~ auto_delete                = true -> false

Actual Behavior

      ~ boot_disk {
          ~ auto_delete                = true -> false # forces replacement

Steps to Reproduce

  1. Import an instance
  2. Change the auto_delete value of its boot disk
  3. terraform apply or terraform plan : notice overeager attempt to recreate instance

References

rileykarson commented 4 years ago

This probably makes sense to fix as part of https://github.com/terraform-providers/terraform-provider-google/issues/6857

rwblokzijl commented 2 years ago

Is there an update on this? Not being able to change this is a killer if you want to redeploy the machine without wiping the boot-disk.

fuog commented 2 years ago

also had problems while moving from standard VM to Spot VM .. spot-VMs forces you to recreate the vm. This is how I first noticed the problem. all our VMs had this feature turned on by default.

philip-harvey commented 1 year ago

Any chance to get this assigned?

ggtisc commented 1 month ago

Currently if you add the deletion_protection argument or change its value results in an update-in-place instead of force-replacement