Instance From Template
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());
}
}
Content copied to clipboard
Import
This resource does not support import.
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
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.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard