ComputeInstance
A resource of the GCP provider, version 0.2.0, in its Compute group. Import it with:
import ComputeInstance from "gcp/compute"Example
resource ComputeInstance example {
name = "example-value"
machineType = "example-value"
zone = "example-value"
imageFamily = "example-value"
imageProject = "example-value"
networkInterface = "example-value"
subnetwork = "example-value"
tags = "..."
labels = "..."
diskSizeGb = 3.14
diskType = "pd-standard"
externalIp = true
startupScript = "example-value"
serviceAccount = "example-value"
scopes = "..."
preemptible = false
}Properties
Set by your code in the resource block. A required one must be set; any other you leave out takes the value under Default, if it has one.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
name | string | — | No | The name of the instance |
machineType | string | — | No | The machine type (e.g., e2-medium, n1-standard-1) |
zone | string | — | No | The zone where the instance will be created (e.g., us-central1-a) |
imageFamily | string | — | No | The image family to use for the boot disk (e.g., debian-12) |
imageProject | string | — | No | The project containing the image family (e.g., debian-cloud) |
networkInterface | string | — | No | The VPC network name or self-link for the primary network interface |
subnetwork | string | — | No | The subnetwork name or self-link for the primary network interface |
tags | any[] | — | No | Network tags for firewall rules |
labels | object | — | No | Labels to apply to the instance |
diskSizeGb | number | — | No | Boot disk size in GB |
diskType | string | — | No | Boot disk type Allowed: "pd-standard", "pd-ssd", "pd-balanced" |
externalIp | boolean | true | No | Whether to assign an external IP address |
startupScript | string | — | No | Startup script content |
serviceAccount | string | — | No | The service account email for the instance |
scopes | any[] | — | No | OAuth2 scopes for the service account |
preemptible | boolean | false | No | Whether to enable preemptible/spot scheduling |
Set by GCP after the resource is created: your code can read them but not set them. An importable one identifies an existing resource.
| Name | Type | Importable | Description |
|---|---|---|---|
instanceId | string | Yes | The unique instance ID assigned by GCP |
status | string | No | The instance status (PROVISIONING, STAGING, RUNNING, STOPPING, STOPPED, TERMINATED) |
selfLink | string | No | The self-link URL of the instance |
externalIpAddress | string | No | The external (public) IP address |
internalIpAddress | string | No | The internal (private) IP address |