InstanceFromMachineImage class
> Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
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
sourceMachineImage. To create an instance without a machine image, use the
gcp.compute.Instance resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const tpl = new gcp.compute.InstanceFromMachineImage("tpl", {
name: "instance-from-machine-image",
zone: "us-central1-a",
sourceMachineImage: "projects/PROJECT-ID/global/machineImages/NAME",
canIpForward: false,
labels: {
my_key: "my_value",
},
});
import pulumi
import pulumi_gcp as gcp
tpl = gcp.compute.InstanceFromMachineImage("tpl",
name="instance-from-machine-image",
zone="us-central1-a",
source_machine_image="projects/PROJECT-ID/global/machineImages/NAME",
can_ip_forward=False,
labels={
"my_key": "my_value",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var tpl = new Gcp.Compute.InstanceFromMachineImage("tpl", new()
{
Name = "instance-from-machine-image",
Zone = "us-central1-a",
SourceMachineImage = "projects/PROJECT-ID/global/machineImages/NAME",
CanIpForward = false,
Labels =
{
{ "my_key", "my_value" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstanceFromMachineImage(ctx, "tpl", &compute.InstanceFromMachineImageArgs{
Name: pulumi.String("instance-from-machine-image"),
Zone: pulumi.String("us-central1-a"),
SourceMachineImage: pulumi.String("projects/PROJECT-ID/global/machineImages/NAME"),
CanIpForward: pulumi.Bool(false),
Labels: pulumi.StringMap{
"my_key": pulumi.String("my_value"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_compute_instancefrommachineimage" "tpl" {
name = "instance-from-machine-image"
zone = "us-central1-a"
source_machine_image = "projects/PROJECT-ID/global/machineImages/NAME"
can_ip_forward = false
labels = {
"my_key" = "my_value"
}
}
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 java.util.ArrayList;
import java.util.Arrays;
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()
.name("instance-from-machine-image")
.zone("us-central1-a")
.sourceMachineImage("projects/PROJECT-ID/global/machineImages/NAME")
.canIpForward(false)
.labels(Map.of("my_key", "my_value"))
.build());
}
}
resources:
tpl:
type: gcp:compute:InstanceFromMachineImage
properties:
name: instance-from-machine-image
zone: us-central1-a
sourceMachineImage: projects/PROJECT-ID/global/machineImages/NAME
canIpForward: false
labels:
my_key: my_value
Constructors
- InstanceFromMachineImage(String name, {InstanceFromMachineImageArgs? args, CustomResourceOptions? options})
-
Creates a new InstanceFromMachineImage.
nameThe Pulumi resource name.argsArguments used to configure this InstanceFromMachineImage. The set of arguments for InstanceFromMachineImage.optionsResource options controlling this resource's behavior. - InstanceFromMachineImage.reference(String urn)
- Creates a typed reference to an existing InstanceFromMachineImage resource.
Properties
-
advancedMachineFeatures
↔ Output<
InstanceFromMachineImageAdvancedMachineFeatures> -
Controls for advanced machine-related behavior features.
latefinal
-
allowStoppingForUpdate
↔ Output<
bool> -
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.
latefinal
-
attachedDisks
↔ Output<
List< InstanceFromMachineImageAttachedDisk> > -
List of disks attached to the instance
latefinal
-
bootDisks
↔ Output<
List< InstanceFromMachineImageBootDisk> > -
The boot disk for the instance.
latefinal
-
canIpForward
↔ Output<
bool> -
Whether sending and receiving of packets with non-matching source or destination IPs is allowed.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
confidentialInstanceConfig
↔ Output<
InstanceFromMachineImageConfidentialInstanceConfig> -
The Confidential VM config being used by the instance. onHostMaintenance has to be set to TERMINATE or this will fail to create.
latefinal
-
cpuPlatform
↔ Output<
String> -
The CPU platform used by this instance.
latefinal
-
creationTimestamp
↔ Output<
String> -
Creation timestamp in RFC3339 text format.
latefinal
-
currentStatus
↔ Output<
String> -
Current status of the instance.
This could be one of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED.
For more information about the status of the instance, see Instance life cycle.
latefinal
-
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE".
When a 'terraform destroy' or 'terraform apply' would delete the instance,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
deletionProtection
↔ Output<
bool> -
Whether deletion protection is enabled on this instance.
latefinal
-
description
↔ Output<
String> -
A brief description of the resource.
latefinal
-
desiredStatus
↔ Output<
String> -
Desired status of the instance. Either "RUNNING", "SUSPENDED" or "TERMINATED".
latefinal
-
effectiveLabels
↔ Output<
Map< String, String> > -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
latefinal
-
enableDisplay
↔ Output<
bool> -
Whether the instance has virtual displays enabled.
latefinal
-
eraseWindowsVssSignature
↔ Output<
bool> -
Specifies whether the disks restored from source snapshots or source machine image should erase Windows specific VSS signature.
latefinal
-
guestAccelerators
↔ Output<
List< InstanceFromMachineImageGuestAccelerator> > -
List of the type and count of accelerator cards attached to the instance.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hostname
↔ Output<
String> -
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-z, concatenated with periods. The entire hostname must not exceed 253 characters. Changing this forces a new resource to be created.
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
-
instanceEncryptionKey
↔ Output<
InstanceFromMachineImageInstanceEncryptionKey> -
Encryption key used to provide data encryption on the given instance.
latefinal
-
instanceId
↔ Output<
String> -
The server-assigned unique identifier of this instance.
latefinal
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
keyRevocationActionType
↔ Output<
String> -
Action to be taken when a customer's encryption key is revoked. Supports "STOP" and "NONE", with "NONE" being the default.
latefinal
-
labelFingerprint
↔ Output<
String> -
The unique fingerprint of the labels.
latefinal
-
labels
↔ Output<
Map< String, String> > -
A set of key/value label pairs assigned to the instance.
latefinal
-
machineType
↔ Output<
String> -
The machine type to create.
latefinal
-
metadata
↔ Output<
Map< String, String> > -
Metadata key/value pairs made available within the instance.
latefinal
-
metadataFingerprint
↔ Output<
String> -
The unique fingerprint of the metadata.
latefinal
-
metadataStartupScript
↔ Output<
String> -
Metadata startup scripts made available within the instance.
latefinal
-
minCpuPlatform
↔ Output<
String> -
The minimum CPU platform specified for the VM instance.
latefinal
-
name
↔ Output<
String> -
A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
latefinal
-
networkInterfaces
↔ Output<
List< InstanceFromMachineImageNetworkInterface> > -
The networks attached to the instance.
latefinal
-
networkPerformanceConfig
↔ Output<
InstanceFromMachineImageNetworkPerformanceConfig> -
Configures network performance settings for the instance. If not specified, the instance will be created with its default network performance configuration.
latefinal
-
params
↔ Output<
InstanceFromMachineImageParams> -
Stores additional params passed with the request, but not persisted as part of resource payload.
latefinal
-
partnerMetadata
↔ Output<
Map< String, String> > -
Partner Metadata Map made available within the instance.
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs. If selfLink is provided, this value is ignored. If neither selfLink nor project are provided, the provider project is used.
latefinal
-
pulumiLabels
↔ Output<
Map< String, String> > -
The combination of labels configured directly on the resource and default labels configured on the provider.
latefinal
-
reservationAffinity
↔ Output<
InstanceFromMachineImageReservationAffinity> -
Specifies the reservations that this instance can consume from.
latefinal
-
resourcePolicies
↔ Output<
String> -
A list of selfLinks of resource policies to attach to the instance. Currently a max of 1 resource policy is supported.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scheduling
↔ Output<
InstanceFromMachineImageScheduling> -
The scheduling strategy being used by the instance.
latefinal
-
scratchDisks
↔ Output<
List< InstanceFromMachineImageScratchDisk> > -
The scratch disks attached to the instance.
latefinal
-
selfLink
↔ Output<
String> -
The URI of the created resource.
latefinal
-
serviceAccount
↔ Output<
InstanceFromMachineImageServiceAccount> -
The service account to attach to the instance.
latefinal
-
shieldedInstanceConfig
↔ Output<
InstanceFromMachineImageShieldedInstanceConfig> -
The shielded vm config being used by the instance.
latefinal
-
sourceMachineImage
↔ Output<
String> -
Name or self link of a machine
image to create the instance based on.
latefinal
-
sourceMachineImageEncryptionKey
↔ Output<
InstanceFromMachineImageSourceMachineImageEncryptionKey?> -
Encryption key for the source machine image.
latefinal
-
The list of tags attached to the instance.
latefinal
-
The unique fingerprint of the tags.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
workloadIdentityConfig
↔ Output<
InstanceFromMachineImageWorkloadIdentityConfig> -
Workload identity config.
latefinal
-
zone
↔ Output<
String> -
The zone that the machine should be created in. If not
set, the provider zone is used.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {InstanceFromMachineImageState? state, CustomResourceOptions? options}) → InstanceFromMachineImage -
Gets an existing InstanceFromMachineImage resource's state with the given
nameandid.