UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

350 lines (349 loc) • 13.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Policy-based Routes are more powerful routes that route L4 network traffic based on not just destination IP, but also source IP, protocol and more. A Policy-based Route always take precedence when it conflicts with other types of routes. * * To get more information about PolicyBasedRoute, see: * * * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.global.policyBasedRoutes) * * How-to Guides * * [Use policy-based routes](https://cloud.google.com/vpc/docs/use-policy-based-routes#api) * * ## Example Usage * * ### Network Connectivity Policy Based Route Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myNetwork = new gcp.compute.Network("my_network", { * name: "my-network", * autoCreateSubnetworks: false, * }); * const _default = new gcp.networkconnectivity.PolicyBasedRoute("default", { * name: "my-pbr", * network: myNetwork.id, * filter: { * protocolVersion: "IPV4", * }, * nextHopOtherRoutes: "DEFAULT_ROUTING", * }); * ``` * ### Network Connectivity Policy Based Route Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myNetwork = new gcp.compute.Network("my_network", { * name: "my-network", * autoCreateSubnetworks: false, * }); * // This example substitutes an arbitrary internal IP for an internal network * // load balancer for brevity. Consult https://cloud.google.com/load-balancing/docs/internal * // to set one up. * const ilb = new gcp.compute.GlobalAddress("ilb", {name: "my-ilb"}); * const _default = new gcp.networkconnectivity.PolicyBasedRoute("default", { * name: "my-pbr", * description: "My routing policy", * network: myNetwork.id, * priority: 2302, * filter: { * protocolVersion: "IPV4", * ipProtocol: "UDP", * srcRange: "10.0.0.0/24", * destRange: "0.0.0.0/0", * }, * nextHopIlbIp: ilb.address, * virtualMachine: { * tags: ["restricted"], * }, * labels: { * env: "default", * }, * }); * ``` * * ## Import * * PolicyBasedRoute can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/global/policyBasedRoutes/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, PolicyBasedRoute can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default projects/{{project}}/locations/global/policyBasedRoutes/{{name}} * ``` * * ```sh * $ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default {{name}} * ``` */ export declare class PolicyBasedRoute extends pulumi.CustomResource { /** * Get an existing PolicyBasedRoute 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?: PolicyBasedRouteState, opts?: pulumi.CustomResourceOptions): PolicyBasedRoute; /** * Returns true if the given object is an instance of PolicyBasedRoute. 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 PolicyBasedRoute; /** * Time when the policy-based route was created. */ readonly createTime: pulumi.Output<string>; /** * An optional description of this resource. */ readonly description: pulumi.Output<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * The filter to match L4 traffic. * Structure is documented below. */ readonly filter: pulumi.Output<outputs.networkconnectivity.PolicyBasedRouteFilter>; /** * The interconnect attachments that this policy-based route applies to. * Structure is documented below. */ readonly interconnectAttachment: pulumi.Output<outputs.networkconnectivity.PolicyBasedRouteInterconnectAttachment | undefined>; /** * Type of this resource. */ readonly kind: pulumi.Output<string>; /** * User-defined labels. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The name of the policy based route. */ readonly name: pulumi.Output<string>; /** * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. */ readonly network: pulumi.Output<string>; /** * The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets. */ readonly nextHopIlbIp: pulumi.Output<string | undefined>; /** * Other routes that will be referenced to determine the next hop of the packet. * Possible values are: `DEFAULT_ROUTING`. */ readonly nextHopOtherRoutes: pulumi.Output<string | undefined>; /** * The priority of this policy-based route. Priority is used to break ties in cases where there are more than one matching policy-based routes found. In cases where multiple policy-based routes are matched, the one with the lowest-numbered priority value wins. The default value is 1000. The priority value must be from 1 to 65535, inclusive. */ readonly priority: pulumi.Output<number | 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>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * Time when the policy-based route was created. */ readonly updateTime: pulumi.Output<string>; /** * VM instances to which this policy-based route applies to. * Structure is documented below. */ readonly virtualMachine: pulumi.Output<outputs.networkconnectivity.PolicyBasedRouteVirtualMachine | undefined>; /** * If potential misconfigurations are detected for this route, this field will be populated with warning messages. * Structure is documented below. */ readonly warnings: pulumi.Output<outputs.networkconnectivity.PolicyBasedRouteWarning[]>; /** * Create a PolicyBasedRoute 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: PolicyBasedRouteArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering PolicyBasedRoute resources. */ export interface PolicyBasedRouteState { /** * Time when the policy-based route was created. */ createTime?: pulumi.Input<string>; /** * An optional description of this resource. */ description?: pulumi.Input<string>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The filter to match L4 traffic. * Structure is documented below. */ filter?: pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteFilter>; /** * The interconnect attachments that this policy-based route applies to. * Structure is documented below. */ interconnectAttachment?: pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteInterconnectAttachment>; /** * Type of this resource. */ kind?: pulumi.Input<string>; /** * User-defined labels. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The name of the policy based route. */ name?: pulumi.Input<string>; /** * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. */ network?: pulumi.Input<string>; /** * The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets. */ nextHopIlbIp?: pulumi.Input<string>; /** * Other routes that will be referenced to determine the next hop of the packet. * Possible values are: `DEFAULT_ROUTING`. */ nextHopOtherRoutes?: pulumi.Input<string>; /** * The priority of this policy-based route. Priority is used to break ties in cases where there are more than one matching policy-based routes found. In cases where multiple policy-based routes are matched, the one with the lowest-numbered priority value wins. The default value is 1000. The priority value must be from 1 to 65535, inclusive. */ priority?: pulumi.Input<number>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Time when the policy-based route was created. */ updateTime?: pulumi.Input<string>; /** * VM instances to which this policy-based route applies to. * Structure is documented below. */ virtualMachine?: pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteVirtualMachine>; /** * If potential misconfigurations are detected for this route, this field will be populated with warning messages. * Structure is documented below. */ warnings?: pulumi.Input<pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteWarning>[]>; } /** * The set of arguments for constructing a PolicyBasedRoute resource. */ export interface PolicyBasedRouteArgs { /** * An optional description of this resource. */ description?: pulumi.Input<string>; /** * The filter to match L4 traffic. * Structure is documented below. */ filter: pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteFilter>; /** * The interconnect attachments that this policy-based route applies to. * Structure is documented below. */ interconnectAttachment?: pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteInterconnectAttachment>; /** * User-defined labels. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The name of the policy based route. */ name?: pulumi.Input<string>; /** * Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. */ network: pulumi.Input<string>; /** * The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets. */ nextHopIlbIp?: pulumi.Input<string>; /** * Other routes that will be referenced to determine the next hop of the packet. * Possible values are: `DEFAULT_ROUTING`. */ nextHopOtherRoutes?: pulumi.Input<string>; /** * The priority of this policy-based route. Priority is used to break ties in cases where there are more than one matching policy-based routes found. In cases where multiple policy-based routes are matched, the one with the lowest-numbered priority value wins. The default value is 1000. The priority value must be from 1 to 65535, inclusive. */ priority?: pulumi.Input<number>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * VM instances to which this policy-based route applies to. * Structure is documented below. */ virtualMachine?: pulumi.Input<inputs.networkconnectivity.PolicyBasedRouteVirtualMachine>; }