PolicyBasedRoute

class PolicyBasedRoute : KotlinCustomResource

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}}

Properties

Link copied to clipboard
val createTime: Output<String>

Time when the policy-based route was created.

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

An optional description of this resource.

Link copied to clipboard

All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.

Link copied to clipboard

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

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

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

Link copied to clipboard
val kind: Output<String>

Type of this resource.

Link copied to clipboard
val labels: Output<Map<String, 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 effective_labels for all of the labels present on the resource.

Link copied to clipboard
val name: Output<String>

The name of the policy based route.

Link copied to clipboard
val network: Output<String>

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>?

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

Link copied to clipboard

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>?

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>

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
val pulumiLabels: Output<Map<String, String>>

The combination of labels configured directly on the resource and default labels configured on the provider.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val updateTime: Output<String>

Time when the policy-based route was created.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

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

Link copied to clipboard

If potential misconfigurations are detected for this route, this field will be populated with warning messages. Structure is documented below.