import * as pulumi from "@pulumi/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: * * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/targetInstances) * * How-to Guides * * [Using Protocol Forwarding](https://cloud.google.com/compute/docs/protocol-forwarding) * * ## Example Usage * * ### Target Instance Basic * * ```typescript * 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", { * name: "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", { * name: "target", * instance: target_vm.id, * }); * ``` * ### Target Instance Custom Network * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const target_vm = gcp.compute.getNetwork({ * name: "default", * }); * const vmimage = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const target_vmInstance = new gcp.compute.Instance("target-vm", { * name: "custom-network-target-vm", * machineType: "e2-medium", * zone: "us-central1-a", * bootDisk: { * initializeParams: { * image: vmimage.then(vmimage => vmimage.selfLink), * }, * }, * networkInterfaces: [{ * network: "default", * }], * }); * const customNetwork = new gcp.compute.TargetInstance("custom_network", { * name: "custom-network", * instance: target_vmInstance.id, * network: target_vm.then(target_vm => target_vm.selfLink), * }); * ``` * ### Target Instance With Security Policy * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "custom-default-network", * autoCreateSubnetworks: false, * routingMode: "REGIONAL", * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "custom-default-subnet", * ipCidrRange: "10.1.2.0/24", * network: _default.id, * privateIpv6GoogleAccess: "DISABLE_GOOGLE_ACCESS", * purpose: "PRIVATE", * region: "southamerica-west1", * stackType: "IPV4_ONLY", * }); * const vmimage = gcp.compute.getImage({ * family: "debian-11", * project: "debian-cloud", * }); * const target_vm = new gcp.compute.Instance("target-vm", { * networkInterfaces: [{ * accessConfigs: [{}], * network: _default.selfLink, * subnetwork: defaultSubnetwork.selfLink, * }], * name: "target-vm", * machineType: "e2-medium", * zone: "southamerica-west1-a", * bootDisk: { * initializeParams: { * image: vmimage.then(vmimage => vmimage.selfLink), * }, * }, * }); * const policyddosprotection = new gcp.compute.RegionSecurityPolicy("policyddosprotection", { * region: "southamerica-west1", * name: "tf-test-policyddos_52865", * description: "ddos protection security policy to set target instance", * type: "CLOUD_ARMOR_NETWORK", * ddosProtectionConfig: { * ddosProtection: "ADVANCED_PREVIEW", * }, * }); * const edgeSecService = new gcp.compute.NetworkEdgeSecurityService("edge_sec_service", { * region: "southamerica-west1", * name: "tf-test-edgesec_85840", * securityPolicy: policyddosprotection.selfLink, * }); * const regionsecuritypolicy = new gcp.compute.RegionSecurityPolicy("regionsecuritypolicy", { * name: "region-secpolicy", * region: "southamerica-west1", * description: "basic security policy for target instance", * type: "CLOUD_ARMOR_NETWORK", * }, { * dependsOn: [edgeSecService], * }); * const defaultTargetInstance = new gcp.compute.TargetInstance("default", { * name: "target-instance", * zone: "southamerica-west1-a", * instance: target_vm.id, * securityPolicy: regionsecuritypolicy.selfLink, * }); * ``` * * ## Import * * TargetInstance can be imported using any of these accepted formats: * * * `projects/{{project}}/zones/{{zone}}/targetInstances/{{name}}` * * * `{{project}}/{{zone}}/{{name}}` * * * `{{zone}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, TargetInstance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/targetInstance:TargetInstance default projects/{{project}}/zones/{{zone}}/targetInstances/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/targetInstance:TargetInstance default {{project}}/{{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/targetInstance:TargetInstance default {{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/targetInstance:TargetInstance default {{name}} * ``` */ export declare class TargetInstance extends pulumi.CustomResource { /** * Get an existing TargetInstance resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: TargetInstanceState, opts?: pulumi.CustomResourceOptions): TargetInstance; /** * Returns true if the given object is an instance of TargetInstance. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is TargetInstance; /** * Creation timestamp in RFC3339 text format. */ readonly creationTimestamp: pulumi.Output; /** * An optional description of this resource. */ readonly description: pulumi.Output; /** * 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. */ readonly instance: pulumi.Output; /** * 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. */ readonly name: pulumi.Output; /** * 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`. */ readonly natPolicy: pulumi.Output; /** * 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. */ readonly network: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The resource URL for the security policy associated with this target instance. */ readonly securityPolicy: pulumi.Output; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output; /** * URL of the zone where the target instance resides. */ readonly zone: pulumi.Output; /** * Create a TargetInstance resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: TargetInstanceArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering TargetInstance resources. */ export interface TargetInstanceState { /** * Creation timestamp in RFC3339 text format. */ creationTimestamp?: pulumi.Input; /** * An optional description of this resource. */ description?: pulumi.Input; /** * 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. */ instance?: pulumi.Input; /** * 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. */ name?: pulumi.Input; /** * 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`. */ natPolicy?: pulumi.Input; /** * 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. */ network?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The resource URL for the security policy associated with this target instance. */ securityPolicy?: pulumi.Input; /** * The URI of the created resource. */ selfLink?: pulumi.Input; /** * URL of the zone where the target instance resides. */ zone?: pulumi.Input; } /** * The set of arguments for constructing a TargetInstance resource. */ export interface TargetInstanceArgs { /** * An optional description of this resource. */ description?: pulumi.Input; /** * 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. */ instance: pulumi.Input; /** * 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. */ name?: pulumi.Input; /** * 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`. */ natPolicy?: pulumi.Input; /** * 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. */ network?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The resource URL for the security policy associated with this target instance. */ securityPolicy?: pulumi.Input; /** * URL of the zone where the target instance resides. */ zone?: pulumi.Input; }