@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
390 lines • 15.6 kB
TypeScript
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_39249",
* 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_74391",
* 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}}
* $ 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}}
* ```
*/
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<pulumi.ID>, 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<string>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* 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.
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* An optional description of this resource.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* 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<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.
*/
readonly name: pulumi.Output<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`.
*/
readonly natPolicy: pulumi.Output<string | undefined>;
/**
* (Optional, Beta)
* 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<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* (Optional, Beta)
* The resource URL for the security policy associated with this target instance.
*/
readonly securityPolicy: pulumi.Output<string | undefined>;
/**
* The URI of the created resource.
*/
readonly selfLink: pulumi.Output<string>;
/**
* URL of the zone where the target instance resides.
*/
readonly zone: pulumi.Output<string>;
/**
* 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<string | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* 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.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string | undefined>;
/**
* 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<string | undefined>;
/**
* 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<string | undefined>;
/**
* 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<string | undefined>;
/**
* (Optional, Beta)
* 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<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* (Optional, Beta)
* The resource URL for the security policy associated with this target instance.
*/
securityPolicy?: pulumi.Input<string | undefined>;
/**
* The URI of the created resource.
*/
selfLink?: pulumi.Input<string | undefined>;
/**
* URL of the zone where the target instance resides.
*/
zone?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a TargetInstance resource.
*/
export interface TargetInstanceArgs {
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* 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.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string | undefined>;
/**
* 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<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.
*/
name?: pulumi.Input<string | undefined>;
/**
* 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<string | undefined>;
/**
* (Optional, Beta)
* 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<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* (Optional, Beta)
* The resource URL for the security policy associated with this target instance.
*/
securityPolicy?: pulumi.Input<string | undefined>;
/**
* URL of the zone where the target instance resides.
*/
zone?: pulumi.Input<string | undefined>;
}
//# sourceMappingURL=targetInstance.d.ts.map