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

when rebuilding a boot disk it does not re attach. #20997

Open
cah-bartholomew-rings opened this issue Jan 22, 2025 · 1 comment
Open

when rebuilding a boot disk it does not re attach. #20997

cah-bartholomew-rings opened this issue Jan 22, 2025 · 1 comment

Comments

@cah-bartholomew-rings
Copy link

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.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Description

when rebuilding a boot disk it does not attach. terraform will detach and destroy, then rebuild the boot disk, but will not re attach the new one.
there is not flag on the google_compute_attached_disk to attach as boot.

New or Affected Resource(s)

google_compute_attached_disk
or
google_compute_instance

Potential Terraform Configuration

resource "google_compute_attached_disk" "boot_disks" {

device_name = boot_disk
disk = "projects/${var.project_id}/zones/${var.zone}/disks/disk_name"
instance = google_compute_instance.default.id
project = google_compute_instance.default.project
zone = google_compute_instance.default.zone
boot = true
}

References

No response

@karolgorc
Copy link

There isn't a field like boot for the disk resource in the API. You can attach it from within the google_compute_instance resource.

You should also use google_compute_disk instead of google_compute_attached_disk because you cannot specify the image in the latter

resource "google_compute_disk" "boot_disk" {
  name  = "boot"
  type  = "pd-ssd"
  zone  = var.zone
  size  = 10
  image = "debian-cloud/debian-11"
}

resource "google_compute_instance" "test" {
  name         = "test"
  machine_type = "e2-micro"

  boot_disk {
    source = google_compute_disk.boot_disk.id
  }

  network_interface {
    network = "default"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants