Instance From Template Args
Manages a VM instance resource within GCE. For more information see the official documentation and API. This resource is specifically to create a compute instance from a given source_instance_template
. To create an instance without a template, use the gcp.compute.Instance
resource.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.InstanceTemplate;
import com.pulumi.gcp.compute.InstanceTemplateArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateNetworkInterfaceArgs;
import com.pulumi.gcp.compute.InstanceFromTemplate;
import com.pulumi.gcp.compute.InstanceFromTemplateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var tplInstanceTemplate = new InstanceTemplate("tplInstanceTemplate", InstanceTemplateArgs.builder()
.machineType("e2-medium")
.disks(InstanceTemplateDiskArgs.builder()
.sourceImage("debian-cloud/debian-11")
.autoDelete(true)
.diskSizeGb(100)
.boot(true)
.build())
.networkInterfaces(InstanceTemplateNetworkInterfaceArgs.builder()
.network("default")
.build())
.metadata(Map.of("foo", "bar"))
.canIpForward(true)
.build());
var tplInstanceFromTemplate = new InstanceFromTemplate("tplInstanceFromTemplate", InstanceFromTemplateArgs.builder()
.zone("us-central1-a")
.sourceInstanceTemplate(tplInstanceTemplate.selfLinkUnique())
.canIpForward(false)
.labels(Map.of("my_key", "my_value"))
.build());
}
}
Import
This resource does not support import.
Constructors
Properties
Controls for advanced machine-related behavior features.
If true, allows Terraform to stop the instance to update its properties. If you try to update a property that requires stopping the instance without setting this field, the update will fail.
List of disks attached to the instance
The boot disk for the instance.
Whether sending and receiving of packets with non-matching source or destination IPs is allowed.
The Confidential VM config being used by the instance. on_host_maintenance has to be set to TERMINATE or this will fail to create.
Whether deletion protection is enabled on this instance.
A brief description of the resource.
Desired status of the instance. Either "RUNNING" or "TERMINATED".
Whether the instance has virtual displays enabled.
List of the type and count of accelerator cards attached to the instance.
A custom hostname for the instance. Must be a fully qualified DNS name and RFC-1035-valid. Valid format is a series of labels 1-63 characters long matching the regular expression -a-z0-9]*[a-z0-9, concatenated with periods. The entire hostname must not exceed 253 characters. Changing this forces a new resource to be created.
The machine type to create.
Metadata startup scripts made available within the instance.
The minimum CPU platform specified for the VM instance.
The networks attached to the instance.
Configures network performance settings for the instance. If not specified, the instance will be created with its default network performance configuration.
Stores additional params passed with the request, but not persisted as part of resource payload.
Specifies the reservations that this instance can consume from.
A list of self_links of resource policies to attach to the instance. Currently a max of 1 resource policy is supported.
The scheduling strategy being used by the instance.
The scratch disks attached to the instance.
The service account to attach to the instance.
The shielded vm config being used by the instance.
Name or self link of an instance template to create the instance based on. It is recommended to reference instance templates through their unique id (self_link_unique
attribute).
The zone that the machine should be created in. If not set, the provider zone is used. In addition to these, all arguments from gcp.compute.Instance
are supported as a way to override the properties in the template. All exported attributes from gcp.compute.Instance
are likewise exported here.