1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. TargetInstance
Google Cloud Classic v7.2.1 published on Wednesday, Nov 22, 2023 by Pulumi

gcp.compute.TargetInstance

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.2.1 published on Wednesday, Nov 22, 2023 by Pulumi

    Represents a TargetInstance resource which defines an endpoint instance that terminates traffic of certain protocols. In particular, they are used in Protocol Forwarding, where forwarding rules can send packets to a non-NAT’ed target instance. Each target instance contains a single virtual machine instance that receives and handles traffic from the corresponding forwarding rules.

    To get more information about TargetInstance, see:

    Example Usage

    Target Instance Basic

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var vmimage = Gcp.Compute.GetImage.Invoke(new()
        {
            Family = "debian-11",
            Project = "debian-cloud",
        });
    
        var target_vm = new Gcp.Compute.Instance("target-vm", new()
        {
            MachineType = "e2-medium",
            Zone = "us-central1-a",
            BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
            {
                InitializeParams = new Gcp.Compute.Inputs.InstanceBootDiskInitializeParamsArgs
                {
                    Image = vmimage.Apply(getImageResult => getImageResult.SelfLink),
                },
            },
            NetworkInterfaces = new[]
            {
                new Gcp.Compute.Inputs.InstanceNetworkInterfaceArgs
                {
                    Network = "default",
                },
            },
        });
    
        var @default = new Gcp.Compute.TargetInstance("default", new()
        {
            Instance = target_vm.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		vmimage, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
    			Family:  pulumi.StringRef("debian-11"),
    			Project: pulumi.StringRef("debian-cloud"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewInstance(ctx, "target-vm", &compute.InstanceArgs{
    			MachineType: pulumi.String("e2-medium"),
    			Zone:        pulumi.String("us-central1-a"),
    			BootDisk: &compute.InstanceBootDiskArgs{
    				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
    					Image: *pulumi.String(vmimage.SelfLink),
    				},
    			},
    			NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
    				&compute.InstanceNetworkInterfaceArgs{
    					Network: pulumi.String("default"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewTargetInstance(ctx, "default", &compute.TargetInstanceArgs{
    			Instance: target_vm.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetImageArgs;
    import com.pulumi.gcp.compute.Instance;
    import com.pulumi.gcp.compute.InstanceArgs;
    import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
    import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
    import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
    import com.pulumi.gcp.compute.TargetInstance;
    import com.pulumi.gcp.compute.TargetInstanceArgs;
    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) {
            final var vmimage = ComputeFunctions.getImage(GetImageArgs.builder()
                .family("debian-11")
                .project("debian-cloud")
                .build());
    
            var target_vm = new Instance("target-vm", InstanceArgs.builder()        
                .machineType("e2-medium")
                .zone("us-central1-a")
                .bootDisk(InstanceBootDiskArgs.builder()
                    .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
                        .image(vmimage.applyValue(getImageResult -> getImageResult.selfLink()))
                        .build())
                    .build())
                .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
                    .network("default")
                    .build())
                .build());
    
            var default_ = new TargetInstance("default", TargetInstanceArgs.builder()        
                .instance(target_vm.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_gcp as gcp
    
    vmimage = gcp.compute.get_image(family="debian-11",
        project="debian-cloud")
    target_vm = gcp.compute.Instance("target-vm",
        machine_type="e2-medium",
        zone="us-central1-a",
        boot_disk=gcp.compute.InstanceBootDiskArgs(
            initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
                image=vmimage.self_link,
            ),
        ),
        network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
            network="default",
        )])
    default = gcp.compute.TargetInstance("default", instance=target_vm.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const vmimage = gcp.compute.getImage({
        family: "debian-11",
        project: "debian-cloud",
    });
    const target_vm = new gcp.compute.Instance("target-vm", {
        machineType: "e2-medium",
        zone: "us-central1-a",
        bootDisk: {
            initializeParams: {
                image: vmimage.then(vmimage => vmimage.selfLink),
            },
        },
        networkInterfaces: [{
            network: "default",
        }],
    });
    const _default = new gcp.compute.TargetInstance("default", {instance: target_vm.id});
    
    resources:
      default:
        type: gcp:compute:TargetInstance
        properties:
          instance: ${["target-vm"].id}
      target-vm:
        type: gcp:compute:Instance
        properties:
          machineType: e2-medium
          zone: us-central1-a
          bootDisk:
            initializeParams:
              image: ${vmimage.selfLink}
          networkInterfaces:
            - network: default
    variables:
      vmimage:
        fn::invoke:
          Function: gcp:compute:getImage
          Arguments:
            family: debian-11
            project: debian-cloud
    

    Target Instance Custom Network

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var target_vmNetwork = Gcp.Compute.GetNetwork.Invoke(new()
        {
            Name = "default",
        });
    
        var vmimage = Gcp.Compute.GetImage.Invoke(new()
        {
            Family = "debian-10",
            Project = "debian-cloud",
        });
    
        var target_vmInstance = new Gcp.Compute.Instance("target-vmInstance", new()
        {
            MachineType = "e2-medium",
            Zone = "us-central1-a",
            BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
            {
                InitializeParams = new Gcp.Compute.Inputs.InstanceBootDiskInitializeParamsArgs
                {
                    Image = vmimage.Apply(getImageResult => getImageResult.SelfLink),
                },
            },
            NetworkInterfaces = new[]
            {
                new Gcp.Compute.Inputs.InstanceNetworkInterfaceArgs
                {
                    Network = "default",
                },
            },
        }, new CustomResourceOptions
        {
            Provider = google_beta,
        });
    
        var customNetwork = new Gcp.Compute.TargetInstance("customNetwork", new()
        {
            Instance = target_vmInstance.Id,
            Network = target_vmNetwork.Apply(target_vmNetwork => target_vmNetwork.Apply(getNetworkResult => getNetworkResult.SelfLink)),
        }, new CustomResourceOptions
        {
            Provider = google_beta,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		target_vmNetwork, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
    			Name: "default",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		vmimage, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
    			Family:  pulumi.StringRef("debian-10"),
    			Project: pulumi.StringRef("debian-cloud"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewInstance(ctx, "target-vmInstance", &compute.InstanceArgs{
    			MachineType: pulumi.String("e2-medium"),
    			Zone:        pulumi.String("us-central1-a"),
    			BootDisk: &compute.InstanceBootDiskArgs{
    				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
    					Image: *pulumi.String(vmimage.SelfLink),
    				},
    			},
    			NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
    				&compute.InstanceNetworkInterfaceArgs{
    					Network: pulumi.String("default"),
    				},
    			},
    		}, pulumi.Provider(google_beta))
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewTargetInstance(ctx, "customNetwork", &compute.TargetInstanceArgs{
    			Instance: target_vmInstance.ID(),
    			Network:  *pulumi.String(target_vmNetwork.SelfLink),
    		}, pulumi.Provider(google_beta))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
    import com.pulumi.gcp.compute.inputs.GetImageArgs;
    import com.pulumi.gcp.compute.Instance;
    import com.pulumi.gcp.compute.InstanceArgs;
    import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
    import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
    import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
    import com.pulumi.gcp.compute.TargetInstance;
    import com.pulumi.gcp.compute.TargetInstanceArgs;
    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) {
            final var target-vmNetwork = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
                .name("default")
                .build());
    
            final var vmimage = ComputeFunctions.getImage(GetImageArgs.builder()
                .family("debian-10")
                .project("debian-cloud")
                .build());
    
            var target_vmInstance = new Instance("target-vmInstance", InstanceArgs.builder()        
                .machineType("e2-medium")
                .zone("us-central1-a")
                .bootDisk(InstanceBootDiskArgs.builder()
                    .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
                        .image(vmimage.applyValue(getImageResult -> getImageResult.selfLink()))
                        .build())
                    .build())
                .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
                    .network("default")
                    .build())
                .build(), CustomResourceOptions.builder()
                    .provider(google_beta)
                    .build());
    
            var customNetwork = new TargetInstance("customNetwork", TargetInstanceArgs.builder()        
                .instance(target_vmInstance.id())
                .network(target_vmNetwork.selfLink())
                .build(), CustomResourceOptions.builder()
                    .provider(google_beta)
                    .build());
    
        }
    }
    
    import pulumi
    import pulumi_gcp as gcp
    
    target_vm_network = gcp.compute.get_network(name="default")
    vmimage = gcp.compute.get_image(family="debian-10",
        project="debian-cloud")
    target_vm_instance = gcp.compute.Instance("target-vmInstance",
        machine_type="e2-medium",
        zone="us-central1-a",
        boot_disk=gcp.compute.InstanceBootDiskArgs(
            initialize_params=gcp.compute.InstanceBootDiskInitializeParamsArgs(
                image=vmimage.self_link,
            ),
        ),
        network_interfaces=[gcp.compute.InstanceNetworkInterfaceArgs(
            network="default",
        )],
        opts=pulumi.ResourceOptions(provider=google_beta))
    custom_network = gcp.compute.TargetInstance("customNetwork",
        instance=target_vm_instance.id,
        network=target_vm_network.self_link,
        opts=pulumi.ResourceOptions(provider=google_beta))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const target-vmNetwork = gcp.compute.getNetwork({
        name: "default",
    });
    const vmimage = gcp.compute.getImage({
        family: "debian-10",
        project: "debian-cloud",
    });
    const target_vmInstance = new gcp.compute.Instance("target-vmInstance", {
        machineType: "e2-medium",
        zone: "us-central1-a",
        bootDisk: {
            initializeParams: {
                image: vmimage.then(vmimage => vmimage.selfLink),
            },
        },
        networkInterfaces: [{
            network: "default",
        }],
    }, {
        provider: google_beta,
    });
    const customNetwork = new gcp.compute.TargetInstance("customNetwork", {
        instance: target_vmInstance.id,
        network: target_vmNetwork.then(target_vmNetwork => target_vmNetwork.selfLink),
    }, {
        provider: google_beta,
    });
    
    resources:
      customNetwork:
        type: gcp:compute:TargetInstance
        properties:
          instance: ${["target-vmInstance"].id}
          network: ${["target-vmNetwork"].selfLink}
        options:
          provider: ${["google-beta"]}
      target-vmInstance:
        type: gcp:compute:Instance
        properties:
          machineType: e2-medium
          zone: us-central1-a
          bootDisk:
            initializeParams:
              image: ${vmimage.selfLink}
          networkInterfaces:
            - network: default
        options:
          provider: ${["google-beta"]}
    variables:
      target-vmNetwork:
        fn::invoke:
          Function: gcp:compute:getNetwork
          Arguments:
            name: default
      vmimage:
        fn::invoke:
          Function: gcp:compute:getImage
          Arguments:
            family: debian-10
            project: debian-cloud
    

    Create TargetInstance Resource

    new TargetInstance(name: string, args: TargetInstanceArgs, opts?: CustomResourceOptions);
    @overload
    def TargetInstance(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       description: Optional[str] = None,
                       instance: Optional[str] = None,
                       name: Optional[str] = None,
                       nat_policy: Optional[str] = None,
                       network: Optional[str] = None,
                       project: Optional[str] = None,
                       security_policy: Optional[str] = None,
                       zone: Optional[str] = None)
    @overload
    def TargetInstance(resource_name: str,
                       args: TargetInstanceArgs,
                       opts: Optional[ResourceOptions] = None)
    func NewTargetInstance(ctx *Context, name string, args TargetInstanceArgs, opts ...ResourceOption) (*TargetInstance, error)
    public TargetInstance(string name, TargetInstanceArgs args, CustomResourceOptions? opts = null)
    public TargetInstance(String name, TargetInstanceArgs args)
    public TargetInstance(String name, TargetInstanceArgs args, CustomResourceOptions options)
    
    type: gcp:compute:TargetInstance
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args TargetInstanceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TargetInstanceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TargetInstanceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TargetInstanceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TargetInstanceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    TargetInstance Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The TargetInstance resource accepts the following input properties:

    Instance string

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    Description string

    An optional description of this resource.

    Name string

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    NatPolicy string

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    Network string

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    Project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    SecurityPolicy string

    The resource URL for the security policy associated with this target instance.

    Zone string

    URL of the zone where the target instance resides.

    Instance string

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    Description string

    An optional description of this resource.

    Name string

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    NatPolicy string

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    Network string

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    Project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    SecurityPolicy string

    The resource URL for the security policy associated with this target instance.

    Zone string

    URL of the zone where the target instance resides.

    instance String

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    description String

    An optional description of this resource.

    name String

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    natPolicy String

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network String

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project String

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    securityPolicy String

    The resource URL for the security policy associated with this target instance.

    zone String

    URL of the zone where the target instance resides.

    instance string

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    description string

    An optional description of this resource.

    name string

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    natPolicy string

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network string

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    securityPolicy string

    The resource URL for the security policy associated with this target instance.

    zone string

    URL of the zone where the target instance resides.

    instance str

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    description str

    An optional description of this resource.

    name str

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    nat_policy str

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network str

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project str

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    security_policy str

    The resource URL for the security policy associated with this target instance.

    zone str

    URL of the zone where the target instance resides.

    instance String

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    description String

    An optional description of this resource.

    name String

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    natPolicy String

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network String

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project String

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    securityPolicy String

    The resource URL for the security policy associated with this target instance.

    zone String

    URL of the zone where the target instance resides.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TargetInstance resource produces the following output properties:

    CreationTimestamp string

    Creation timestamp in RFC3339 text format.

    Id string

    The provider-assigned unique ID for this managed resource.

    SelfLink string

    The URI of the created resource.

    CreationTimestamp string

    Creation timestamp in RFC3339 text format.

    Id string

    The provider-assigned unique ID for this managed resource.

    SelfLink string

    The URI of the created resource.

    creationTimestamp String

    Creation timestamp in RFC3339 text format.

    id String

    The provider-assigned unique ID for this managed resource.

    selfLink String

    The URI of the created resource.

    creationTimestamp string

    Creation timestamp in RFC3339 text format.

    id string

    The provider-assigned unique ID for this managed resource.

    selfLink string

    The URI of the created resource.

    creation_timestamp str

    Creation timestamp in RFC3339 text format.

    id str

    The provider-assigned unique ID for this managed resource.

    self_link str

    The URI of the created resource.

    creationTimestamp String

    Creation timestamp in RFC3339 text format.

    id String

    The provider-assigned unique ID for this managed resource.

    selfLink String

    The URI of the created resource.

    Look up Existing TargetInstance Resource

    Get an existing TargetInstance resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TargetInstanceState, opts?: CustomResourceOptions): TargetInstance
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            creation_timestamp: Optional[str] = None,
            description: Optional[str] = None,
            instance: Optional[str] = None,
            name: Optional[str] = None,
            nat_policy: Optional[str] = None,
            network: Optional[str] = None,
            project: Optional[str] = None,
            security_policy: Optional[str] = None,
            self_link: Optional[str] = None,
            zone: Optional[str] = None) -> TargetInstance
    func GetTargetInstance(ctx *Context, name string, id IDInput, state *TargetInstanceState, opts ...ResourceOption) (*TargetInstance, error)
    public static TargetInstance Get(string name, Input<string> id, TargetInstanceState? state, CustomResourceOptions? opts = null)
    public static TargetInstance get(String name, Output<String> id, TargetInstanceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreationTimestamp string

    Creation timestamp in RFC3339 text format.

    Description string

    An optional description of this resource.

    Instance string

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    Name string

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    NatPolicy string

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    Network string

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    Project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    SecurityPolicy string

    The resource URL for the security policy associated with this target instance.

    SelfLink string

    The URI of the created resource.

    Zone string

    URL of the zone where the target instance resides.

    CreationTimestamp string

    Creation timestamp in RFC3339 text format.

    Description string

    An optional description of this resource.

    Instance string

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    Name string

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    NatPolicy string

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    Network string

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    Project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    SecurityPolicy string

    The resource URL for the security policy associated with this target instance.

    SelfLink string

    The URI of the created resource.

    Zone string

    URL of the zone where the target instance resides.

    creationTimestamp String

    Creation timestamp in RFC3339 text format.

    description String

    An optional description of this resource.

    instance String

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    name String

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    natPolicy String

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network String

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project String

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    securityPolicy String

    The resource URL for the security policy associated with this target instance.

    selfLink String

    The URI of the created resource.

    zone String

    URL of the zone where the target instance resides.

    creationTimestamp string

    Creation timestamp in RFC3339 text format.

    description string

    An optional description of this resource.

    instance string

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    name string

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    natPolicy string

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network string

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    securityPolicy string

    The resource URL for the security policy associated with this target instance.

    selfLink string

    The URI of the created resource.

    zone string

    URL of the zone where the target instance resides.

    creation_timestamp str

    Creation timestamp in RFC3339 text format.

    description str

    An optional description of this resource.

    instance str

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    name str

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    nat_policy str

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network str

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project str

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    security_policy str

    The resource URL for the security policy associated with this target instance.

    self_link str

    The URI of the created resource.

    zone str

    URL of the zone where the target instance resides.

    creationTimestamp String

    Creation timestamp in RFC3339 text format.

    description String

    An optional description of this resource.

    instance String

    The Compute instance VM handling traffic for this target instance. Accepts the instance self-link, relative path (e.g. projects/project/zones/zone/instances/instance) or name. If name is given, the zone will default to the given zone or the provider-default zone and the project will default to the provider-level project.


    name String

    Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

    natPolicy String

    NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. Default value is NO_NAT. Possible values are: NO_NAT.

    network String

    The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to.

    project String

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    securityPolicy String

    The resource URL for the security policy associated with this target instance.

    selfLink String

    The URI of the created resource.

    zone String

    URL of the zone where the target instance resides.

    Import

    TargetInstance can be imported using any of these accepted formats* projects/{{project}}/zones/{{zone}}/targetInstances/{{name}} * {{project}}/{{zone}}/{{name}} * {{zone}}/{{name}} * {{name}} In Terraform v1.5.0 and later, use an import block to import TargetInstance using one of the formats above. For exampletf import {

    id = “projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}”

    to = google_compute_target_instance.default }

     $ pulumi import gcp:compute/targetInstance:TargetInstance When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), TargetInstance can be imported using one of the formats above. For example
    
     $ pulumi import gcp:compute/targetInstance:TargetInstance default projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}
    
     $ pulumi import gcp:compute/targetInstance:TargetInstance default {{project}}/{{zone}}/{{name}}
    
     $ pulumi import gcp:compute/targetInstance:TargetInstance default {{zone}}/{{name}}
    
     $ pulumi import gcp:compute/targetInstance:TargetInstance default {{name}}
    

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the google-beta Terraform Provider.

    gcp logo
    Google Cloud Classic v7.2.1 published on Wednesday, Nov 22, 2023 by Pulumi