FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

google_compute_instance

Manages a VM instance resource within GCE. For more information see the official documentation and API.

Example Usage

resource "google_compute_instance" "default" {
  name         = "test"
  machine_type = "n1-standard-1"
  zone         = "us-central1-a"

  tags = ["foo", "bar"]

  disk {
    image = "debian-cloud/debian-8"
  }

  // Local SSD disk
  disk {
    type    = "local-ssd"
    scratch = true
  }

  network_interface {
    network = "default"
    access_config {
      // Ephemeral IP
    }
  }

  metadata {
    foo = "bar"
  }

  metadata_startup_script = "echo hi > /test.txt"

  service_account {
    scopes = ["userinfo-email", "compute-ro", "storage-ro"]
  }
}

Argument Reference

The following arguments are supported:


The disk block supports: (Note that either disk or image is required, unless the type is “local-ssd”, in which case scratch must be true).

The network_interface block supports:

The access_config block supports:

The service_account block supports:

(DEPRECATED) The network block supports:

The scheduling block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:


See the source of this document at Terraform.io