Instance From Machine Image
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_machine_image
. To create an instance without a machine image, 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.InstanceFromMachineImage;
import com.pulumi.gcp.compute.InstanceFromMachineImageArgs;
import com.pulumi.resources.CustomResourceOptions;
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 tpl = new InstanceFromMachineImage("tpl", InstanceFromMachineImageArgs.builder()
.zone("us-central1-a")
.sourceMachineImage("projects/PROJECT-ID/global/machineImages/NAME")
.canIpForward(false)
.labels(Map.of("my_key", "my_value"))
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}
Properties
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 zone that the machine should be created in. If not set, the provider zone is used. In addition to these, most* arguments from gcp.compute.Instance
are supported as a way to override the properties in the machine image. All exported attributes from gcp.compute.Instance
are likewise exported here.