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.33k stars 1.73k forks source link

create the new VM with snapshot ID #12501

Open A-THS5826-temp opened 2 years ago

A-THS5826-temp commented 2 years ago

I wanted to create VM with exiting snapshot IT. where the code in terraform not available. i tried this below resource "google_compute_instance" "vm_instance" { name = "terraform-instance" machine_type = "e2-micro"

boot_disk { initialize_params { sk { disk = "demo-sanpshot" auto_d image = "debian-cloud/debian-11" } } dielete = true }

but no luck

even this also not working disks = { red = { from_snapshot = "REPLACE_ME_WITH_SNAPSHOT_NAME" } }

ljluestc commented 1 year ago
resource "google_compute_instance" "vm_instance" {
  name         = "terraform-instance"
  machine_type = "e2-micro"

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
      snapshot = "YOUR_SNAPSHOT_NAME"  # Replace with the name of your snapshot
    }
  }

  # Other configuration options for your VM instance
  # ...
}
Sankalp951 commented 6 months ago

Hi @A-THS5826-temp - Can you please provide more details on error you are getting or more information related to issue along with detaills you are entering to create new VM ? so that can check and help you accordingly.

Thank you. Sankalp