PolicyBasedRouteArgs

data class PolicyBasedRouteArgs(val description: Output<String>? = null, val filter: Output<PolicyBasedRouteFilterArgs>? = null, val interconnectAttachment: Output<PolicyBasedRouteInterconnectAttachmentArgs>? = null, val labels: Output<Map<String, String>>? = null, val name: Output<String>? = null, val network: Output<String>? = null, val nextHopIlbIp: Output<String>? = null, val nextHopOtherRoutes: Output<String>? = null, val priority: Output<Int>? = null, val project: Output<String>? = null, val virtualMachine: Output<PolicyBasedRouteVirtualMachineArgs>? = null) : ConvertibleToJava<PolicyBasedRouteArgs>

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:

Example Usage

Network Connectivity Policy Based Route Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.networkconnectivity.PolicyBasedRoute;
import com.pulumi.gcp.networkconnectivity.PolicyBasedRouteArgs;
import com.pulumi.gcp.networkconnectivity.inputs.PolicyBasedRouteFilterArgs;
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) {
var myNetwork = new Network("myNetwork", NetworkArgs.builder()
.autoCreateSubnetworks(false)
.build());
var default_ = new PolicyBasedRoute("default", PolicyBasedRouteArgs.builder()
.network(myNetwork.id())
.filter(PolicyBasedRouteFilterArgs.builder()
.protocolVersion("IPV4")
.build())
.nextHopOtherRoutes("DEFAULT_ROUTING")
.build());
}
}

Network Connectivity Policy Based Route Full

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.GlobalAddress;
import com.pulumi.gcp.networkconnectivity.PolicyBasedRoute;
import com.pulumi.gcp.networkconnectivity.PolicyBasedRouteArgs;
import com.pulumi.gcp.networkconnectivity.inputs.PolicyBasedRouteFilterArgs;
import com.pulumi.gcp.networkconnectivity.inputs.PolicyBasedRouteVirtualMachineArgs;
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) {
var myNetwork = new Network("myNetwork", NetworkArgs.builder()
.autoCreateSubnetworks(false)
.build());
var ilb = new GlobalAddress("ilb");
var default_ = new PolicyBasedRoute("default", PolicyBasedRouteArgs.builder()
.description("My routing policy")
.network(myNetwork.id())
.priority(2302)
.filter(PolicyBasedRouteFilterArgs.builder()
.protocolVersion("IPV4")
.ipProtocol("UDP")
.srcRange("10.0.0.0/24")
.destRange("0.0.0.0/0")
.build())
.nextHopIlbIp(ilb.address())
.virtualMachine(PolicyBasedRouteVirtualMachineArgs.builder()
.tags("restricted")
.build())
.labels(Map.of("env", "default"))
.build());
}
}

Import

PolicyBasedRoute can be imported using any of these accepted formats* projects/{{project}}/locations/global/policyBasedRoutes/{{name}} * {{project}}/{{name}} * {{name}} In Terraform v1.5.0 and later, use an import block to import PolicyBasedRoute using one of the formats above. For exampletf import { id = "projects/{{project}}/locations/global/policyBasedRoutes/{{name}}" to = google_network_connectivity_policy_based_route.default }

$ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), PolicyBasedRoute can be imported using one of the formats above. For example
$ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default projects/{{project}}/locations/global/policyBasedRoutes/{{name}}
$ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default {{project}}/{{name}}
$ pulumi import gcp:networkconnectivity/policyBasedRoute:PolicyBasedRoute default {{name}}

Constructors

Link copied to clipboard
fun PolicyBasedRouteArgs(description: Output<String>? = null, filter: Output<PolicyBasedRouteFilterArgs>? = null, interconnectAttachment: Output<PolicyBasedRouteInterconnectAttachmentArgs>? = null, labels: Output<Map<String, String>>? = null, name: Output<String>? = null, network: Output<String>? = null, nextHopIlbIp: Output<String>? = null, nextHopOtherRoutes: Output<String>? = null, priority: Output<Int>? = null, project: Output<String>? = null, virtualMachine: Output<PolicyBasedRouteVirtualMachineArgs>? = null)

Functions

Link copied to clipboard
open override fun toJava(): PolicyBasedRouteArgs

Properties

Link copied to clipboard
val description: Output<String>? = null

An optional description of this resource.

Link copied to clipboard
val filter: Output<PolicyBasedRouteFilterArgs>? = null

The filter to match L4 traffic. Structure is documented below.

Link copied to clipboard

The interconnect attachments that this policy-based route applies to. Structure is documented below.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

User-defined labels. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

Link copied to clipboard
val name: Output<String>? = null

The name of the policy based route.

Link copied to clipboard
val network: Output<String>? = null

Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network.

Link copied to clipboard
val nextHopIlbIp: Output<String>? = null

The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets.

Link copied to clipboard
val nextHopOtherRoutes: Output<String>? = null

Other routes that will be referenced to determine the next hop of the packet. Possible values are: DEFAULT_ROUTING.

Link copied to clipboard
val priority: Output<Int>? = null

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.

Link copied to clipboard
val project: Output<String>? = null

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

Link copied to clipboard

VM instances to which this policy-based route applies to. Structure is documented below.