GoogleComputeInstance class final
Factory wrapper for google_compute_instance.
An instance is a virtual machine (VM) hosted on Google's infrastructure.
Required identity:
localName: Terraform local name (the address segment aftergoogle_compute_instance.).name: GCE instance name. Forces replacement when changed.machineType: short machine type name (e.g.'e2-medium') or full self-link of a custom machine type.bootDisk: a ComputeInstanceBootDisk describing the boot volume; the wrapper converts this to the single-elementboot_diskblock GCP expects.networkInterface: at least one ComputeInstanceNetworkInterface entry. GCP requires every VM to attach to a VPC.
Example (minimal):
final vm = GoogleComputeInstance(
localName: 'web',
name: TfArg.literal('web-01'),
machineType: TfArg.literal('e2-medium'),
zone: TfArg.literal('us-central1-a'),
bootDisk: const ComputeInstanceBootDisk(
initializeParams: ComputeInstanceInitializeParams(
image: 'debian-cloud/debian-12',
),
),
networkInterface: const [
ComputeInstanceNetworkInterface(
network: 'default',
accessConfig: [ComputeInstanceAccessConfig()],
),
],
);
The 12 nested blocks
(boot_disk / network_interface / attached_disk / scratch_disk /
service_account / scheduling / shielded_instance_config /
confidential_instance_config / guest_accelerator /
advanced_machine_features / reservation_affinity / params /
network_performance_config) are modeled as helper classes in the
prelude below. Single-instance blocks (max_items=1) are wrapped in a
[map] list before being passed to Terraform; list-typed blocks are
passed through as List<Map>.
Constructors
-
GoogleComputeInstance({required String localName, required TfArg<
String> name, required TfArg<String> machineType, TfArg<String> ? zone, TfArg<String> ? description, TfArg<String> ? hostname, TfArg<Map< ? labels, TfArg<String, String> >List< ? tags, TfArg<String> >Map< ? metadata, TfArg<String, String> >String> ? metadataStartupScript, TfArg<bool> ? canIpForward, TfArg<bool> ? deletionProtection, TfArg<bool> ? allowStoppingForUpdate, TfArg<String> ? desiredStatus, TfArg<String> ? minCpuPlatform, TfArg<bool> ? enableDisplay, TfArg<List< ? resourcePolicies, TfArg<String> >String> ? keyRevocationActionType, required ComputeInstanceBootDisk bootDisk, required List<ComputeInstanceNetworkInterface> networkInterface, List<ComputeInstanceAttachedDisk> ? attachedDisk, List<ComputeInstanceScratchDisk> ? scratchDisk, ComputeInstanceServiceAccount? serviceAccount, ComputeInstanceScheduling? scheduling, ComputeInstanceShieldedInstanceConfig? shieldedInstanceConfig, ComputeInstanceConfidentialInstanceConfig? confidentialInstanceConfig, List<ComputeInstanceGuestAccelerator> ? guestAccelerator, ComputeInstanceAdvancedMachineFeatures? advancedMachineFeatures, ComputeInstanceReservationAffinity? reservationAffinity, ComputeInstanceInstanceParams? params, ComputeInstanceNetworkPerformanceConfig? networkPerformanceConfig, TfArg<String> ? project, LifecycleOptions? lifecycle, List<DependencyTarget> ? dependsOn})
Properties
-
argMap
→ Map<
String, TfArg?> -
Argument-name → TfArg map. Keys are snake_case (Terraform JSON name).
Synth emits these keys directly; the factory is responsible for the
camelCase → snake_case translation at construction time.
finalinherited
-
cpuPlatform
→ TfRef<
String> -
Reference to
cpu_platformattribute.no setter -
creationTimestamp
→ TfRef<
String> -
Reference to
creation_timestampattribute.no setter -
currentStatus
→ TfRef<
String> -
Reference to
current_statusattribute.no setter -
dependsOn
→ List<
DependencyTarget> ? -
Optional
depends_on = [...]. Each entry is aDependencyTarget— either a wholesale resource (rendered as bare address) or an explicitTfRef(rendered viabareAddress).finalinherited -
effectiveLabels
→ TfRef<
Map< String, String> > -
Reference to
effective_labelsattribute.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
→ TfRef<
String> -
Reference to
idattribute (full pathprojects/{project}/zones/{zone}/instances/{name}).no setter -
instanceId
→ TfRef<
String> -
Reference to
instance_idattribute.no setter - kind → ResourceKind
-
Always
ResourceKind.resource. Overridden byData.no setterinherited -
labelFingerprint
→ TfRef<
String> -
Reference to
label_fingerprintattribute.no setter - lifecycle → LifecycleOptions?
-
Optional
lifecycle { ... }block.finalinherited - localName → String
-
User-supplied local name within a Stack.
finalinherited
-
metadataFingerprint
→ TfRef<
String> -
Reference to
metadata_fingerprintattribute.no setter -
nameRef
→ TfRef<
String> -
Reference to
nameattribute. Use for interpolations likevm.nameRef->${google_compute_instance.<localName>.name}.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selfLink
→ TfRef<
String> -
Reference to
self_linkattribute.no setter -
sensitiveFields
→ Set<
String> -
Field names that are
@Sensitiveper the IR-derived per-resource constant. Curated factories override with a baked-instatic const Set<String>(file-private in v0.5+).no setter - supportsDeletionProtection → bool
-
Capability flag: true when this resource's underlying Terraform
schema has a
deletion_protectionboolean attribute that the synth-time devMode flow can flip tofalse. Defaults to false; the codegen emitter overrides this totruefor wrappers whose schema includes the attribute.no setter -
Reference to
tags_fingerprintattribute.no setter -
terraformLabels
→ TfRef<
Map< String, String> > -
Reference to
terraform_labelsattribute.no setter - terraformType → String
-
Terraform resource type, e.g.
google_pubsub_topic.finalinherited - tfAddress → String
-
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited