1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Core
  5. getRouteTables
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

oci.Core.getRouteTables

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi

This data source provides the list of Route Tables in Oracle Cloud Infrastructure Core service.

Lists the route tables in the specified VCN and specified compartment. If the VCN ID is not provided, then the list includes the route tables from all VCNs in the specified compartment. The response includes the default route table that automatically comes with each VCN in the specified compartment, plus any route tables you’ve created.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testRouteTables = oci.Core.getRouteTables({
    compartmentId: compartmentId,
    displayName: routeTableDisplayName,
    state: routeTableState,
    vcnId: testVcn.id,
});
Copy
import pulumi
import pulumi_oci as oci

test_route_tables = oci.Core.get_route_tables(compartment_id=compartment_id,
    display_name=route_table_display_name,
    state=route_table_state,
    vcn_id=test_vcn["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := core.GetRouteTables(ctx, &core.GetRouteTablesArgs{
			CompartmentId: compartmentId,
			DisplayName:   pulumi.StringRef(routeTableDisplayName),
			State:         pulumi.StringRef(routeTableState),
			VcnId:         pulumi.StringRef(testVcn.Id),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testRouteTables = Oci.Core.GetRouteTables.Invoke(new()
    {
        CompartmentId = compartmentId,
        DisplayName = routeTableDisplayName,
        State = routeTableState,
        VcnId = testVcn.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Core.CoreFunctions;
import com.pulumi.oci.Core.inputs.GetRouteTablesArgs;
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) {
        final var testRouteTables = CoreFunctions.getRouteTables(GetRouteTablesArgs.builder()
            .compartmentId(compartmentId)
            .displayName(routeTableDisplayName)
            .state(routeTableState)
            .vcnId(testVcn.id())
            .build());

    }
}
Copy
variables:
  testRouteTables:
    fn::invoke:
      function: oci:Core:getRouteTables
      arguments:
        compartmentId: ${compartmentId}
        displayName: ${routeTableDisplayName}
        state: ${routeTableState}
        vcnId: ${testVcn.id}
Copy

Using getRouteTables

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getRouteTables(args: GetRouteTablesArgs, opts?: InvokeOptions): Promise<GetRouteTablesResult>
function getRouteTablesOutput(args: GetRouteTablesOutputArgs, opts?: InvokeOptions): Output<GetRouteTablesResult>
Copy
def get_route_tables(compartment_id: Optional[str] = None,
                     display_name: Optional[str] = None,
                     filters: Optional[Sequence[_core.GetRouteTablesFilter]] = None,
                     state: Optional[str] = None,
                     vcn_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetRouteTablesResult
def get_route_tables_output(compartment_id: Optional[pulumi.Input[str]] = None,
                     display_name: Optional[pulumi.Input[str]] = None,
                     filters: Optional[pulumi.Input[Sequence[pulumi.Input[_core.GetRouteTablesFilterArgs]]]] = None,
                     state: Optional[pulumi.Input[str]] = None,
                     vcn_id: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetRouteTablesResult]
Copy
func GetRouteTables(ctx *Context, args *GetRouteTablesArgs, opts ...InvokeOption) (*GetRouteTablesResult, error)
func GetRouteTablesOutput(ctx *Context, args *GetRouteTablesOutputArgs, opts ...InvokeOption) GetRouteTablesResultOutput
Copy

> Note: This function is named GetRouteTables in the Go SDK.

public static class GetRouteTables 
{
    public static Task<GetRouteTablesResult> InvokeAsync(GetRouteTablesArgs args, InvokeOptions? opts = null)
    public static Output<GetRouteTablesResult> Invoke(GetRouteTablesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRouteTablesResult> getRouteTables(GetRouteTablesArgs args, InvokeOptions options)
public static Output<GetRouteTablesResult> getRouteTables(GetRouteTablesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Core/getRouteTables:getRouteTables
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CompartmentId This property is required. string
The OCID of the compartment.
DisplayName string
A filter to return only resources that match the given display name exactly.
Filters Changes to this property will trigger replacement. List<GetRouteTablesFilter>
State string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
VcnId string
The OCID of the VCN.
CompartmentId This property is required. string
The OCID of the compartment.
DisplayName string
A filter to return only resources that match the given display name exactly.
Filters Changes to this property will trigger replacement. []GetRouteTablesFilter
State string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
VcnId string
The OCID of the VCN.
compartmentId This property is required. String
The OCID of the compartment.
displayName String
A filter to return only resources that match the given display name exactly.
filters Changes to this property will trigger replacement. List<GetRouteTablesFilter>
state String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
vcnId String
The OCID of the VCN.
compartmentId This property is required. string
The OCID of the compartment.
displayName string
A filter to return only resources that match the given display name exactly.
filters Changes to this property will trigger replacement. GetRouteTablesFilter[]
state string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
vcnId string
The OCID of the VCN.
compartment_id This property is required. str
The OCID of the compartment.
display_name str
A filter to return only resources that match the given display name exactly.
filters Changes to this property will trigger replacement. Sequence[core.GetRouteTablesFilter]
state str
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
vcn_id str
The OCID of the VCN.
compartmentId This property is required. String
The OCID of the compartment.
displayName String
A filter to return only resources that match the given display name exactly.
filters Changes to this property will trigger replacement. List<Property Map>
state String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
vcnId String
The OCID of the VCN.

getRouteTables Result

The following output properties are available:

CompartmentId string
The OCID of the compartment containing the route table.
Id string
The provider-assigned unique ID for this managed resource.
RouteTables List<GetRouteTablesRouteTable>
The list of route_tables.
DisplayName string
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
Filters List<GetRouteTablesFilter>
State string
The route table's current state.
VcnId string
The OCID of the VCN the route table list belongs to.
CompartmentId string
The OCID of the compartment containing the route table.
Id string
The provider-assigned unique ID for this managed resource.
RouteTables []GetRouteTablesRouteTable
The list of route_tables.
DisplayName string
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
Filters []GetRouteTablesFilter
State string
The route table's current state.
VcnId string
The OCID of the VCN the route table list belongs to.
compartmentId String
The OCID of the compartment containing the route table.
id String
The provider-assigned unique ID for this managed resource.
routeTables List<GetRouteTablesRouteTable>
The list of route_tables.
displayName String
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
filters List<GetRouteTablesFilter>
state String
The route table's current state.
vcnId String
The OCID of the VCN the route table list belongs to.
compartmentId string
The OCID of the compartment containing the route table.
id string
The provider-assigned unique ID for this managed resource.
routeTables GetRouteTablesRouteTable[]
The list of route_tables.
displayName string
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
filters GetRouteTablesFilter[]
state string
The route table's current state.
vcnId string
The OCID of the VCN the route table list belongs to.
compartment_id str
The OCID of the compartment containing the route table.
id str
The provider-assigned unique ID for this managed resource.
route_tables Sequence[core.GetRouteTablesRouteTable]
The list of route_tables.
display_name str
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
filters Sequence[core.GetRouteTablesFilter]
state str
The route table's current state.
vcn_id str
The OCID of the VCN the route table list belongs to.
compartmentId String
The OCID of the compartment containing the route table.
id String
The provider-assigned unique ID for this managed resource.
routeTables List<Property Map>
The list of route_tables.
displayName String
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
filters List<Property Map>
state String
The route table's current state.
vcnId String
The OCID of the VCN the route table list belongs to.

Supporting Types

GetRouteTablesFilter

Name This property is required. string
Values This property is required. List<string>
Regex bool
Name This property is required. string
Values This property is required. []string
Regex bool
name This property is required. String
values This property is required. List<String>
regex Boolean
name This property is required. string
values This property is required. string[]
regex boolean
name This property is required. str
values This property is required. Sequence[str]
regex bool
name This property is required. String
values This property is required. List<String>
regex Boolean

GetRouteTablesRouteTable

CompartmentId This property is required. string
The OCID of the compartment.
DefinedTags This property is required. Dictionary<string, string>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
DisplayName This property is required. string
A filter to return only resources that match the given display name exactly.
FreeformTags This property is required. Dictionary<string, string>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
Id This property is required. string
The route table's Oracle ID (OCID).
RouteRules This property is required. List<GetRouteTablesRouteTableRouteRule>
The collection of rules for routing destination IPs to network devices.
State This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TimeCreated This property is required. string
The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
VcnId This property is required. string
The OCID of the VCN.
CompartmentId This property is required. string
The OCID of the compartment.
DefinedTags This property is required. map[string]string
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
DisplayName This property is required. string
A filter to return only resources that match the given display name exactly.
FreeformTags This property is required. map[string]string
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
Id This property is required. string
The route table's Oracle ID (OCID).
RouteRules This property is required. []GetRouteTablesRouteTableRouteRule
The collection of rules for routing destination IPs to network devices.
State This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TimeCreated This property is required. string
The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
VcnId This property is required. string
The OCID of the VCN.
compartmentId This property is required. String
The OCID of the compartment.
definedTags This property is required. Map<String,String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
displayName This property is required. String
A filter to return only resources that match the given display name exactly.
freeformTags This property is required. Map<String,String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. String
The route table's Oracle ID (OCID).
routeRules This property is required. List<GetRouteTablesRouteTableRouteRule>
The collection of rules for routing destination IPs to network devices.
state This property is required. String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
timeCreated This property is required. String
The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
vcnId This property is required. String
The OCID of the VCN.
compartmentId This property is required. string
The OCID of the compartment.
definedTags This property is required. {[key: string]: string}
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
displayName This property is required. string
A filter to return only resources that match the given display name exactly.
freeformTags This property is required. {[key: string]: string}
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. string
The route table's Oracle ID (OCID).
routeRules This property is required. GetRouteTablesRouteTableRouteRule[]
The collection of rules for routing destination IPs to network devices.
state This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
timeCreated This property is required. string
The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
vcnId This property is required. string
The OCID of the VCN.
compartment_id This property is required. str
The OCID of the compartment.
defined_tags This property is required. Mapping[str, str]
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
display_name This property is required. str
A filter to return only resources that match the given display name exactly.
freeform_tags This property is required. Mapping[str, str]
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. str
The route table's Oracle ID (OCID).
route_rules This property is required. Sequence[core.GetRouteTablesRouteTableRouteRule]
The collection of rules for routing destination IPs to network devices.
state This property is required. str
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
time_created This property is required. str
The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
vcn_id This property is required. str
The OCID of the VCN.
compartmentId This property is required. String
The OCID of the compartment.
definedTags This property is required. Map<String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
displayName This property is required. String
A filter to return only resources that match the given display name exactly.
freeformTags This property is required. Map<String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. String
The route table's Oracle ID (OCID).
routeRules This property is required. List<Property Map>
The collection of rules for routing destination IPs to network devices.
state This property is required. String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
timeCreated This property is required. String
The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
vcnId This property is required. String
The OCID of the VCN.

GetRouteTablesRouteTableRouteRule

CidrBlock This property is required. string
Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

Deprecated: The 'cidr_block' field has been deprecated. Please use 'destination' instead.

Description This property is required. string
An optional description of your choice for the rule.
Destination This property is required. string
Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.
DestinationType This property is required. string
Type of destination for the rule. Required if you provide a destination.

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.
  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).
NetworkEntityId This property is required. string
The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.
RouteType This property is required. string
A route rule can be STATIC if manually added to the route table, LOCAL if added by Oracle Cloud Infrastructure to the route table.
CidrBlock This property is required. string
Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

Deprecated: The 'cidr_block' field has been deprecated. Please use 'destination' instead.

Description This property is required. string
An optional description of your choice for the rule.
Destination This property is required. string
Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.
DestinationType This property is required. string
Type of destination for the rule. Required if you provide a destination.

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.
  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).
NetworkEntityId This property is required. string
The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.
RouteType This property is required. string
A route rule can be STATIC if manually added to the route table, LOCAL if added by Oracle Cloud Infrastructure to the route table.
cidrBlock This property is required. String
Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

Deprecated: The 'cidr_block' field has been deprecated. Please use 'destination' instead.

description This property is required. String
An optional description of your choice for the rule.
destination This property is required. String
Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.
destinationType This property is required. String
Type of destination for the rule. Required if you provide a destination.

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.
  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).
networkEntityId This property is required. String
The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.
routeType This property is required. String
A route rule can be STATIC if manually added to the route table, LOCAL if added by Oracle Cloud Infrastructure to the route table.
cidrBlock This property is required. string
Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

Deprecated: The 'cidr_block' field has been deprecated. Please use 'destination' instead.

description This property is required. string
An optional description of your choice for the rule.
destination This property is required. string
Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.
destinationType This property is required. string
Type of destination for the rule. Required if you provide a destination.

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.
  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).
networkEntityId This property is required. string
The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.
routeType This property is required. string
A route rule can be STATIC if manually added to the route table, LOCAL if added by Oracle Cloud Infrastructure to the route table.
cidr_block This property is required. str
Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

Deprecated: The 'cidr_block' field has been deprecated. Please use 'destination' instead.

description This property is required. str
An optional description of your choice for the rule.
destination This property is required. str
Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.
destination_type This property is required. str
Type of destination for the rule. Required if you provide a destination.

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.
  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).
network_entity_id This property is required. str
The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.
route_type This property is required. str
A route rule can be STATIC if manually added to the route table, LOCAL if added by Oracle Cloud Infrastructure to the route table.
cidrBlock This property is required. String
Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

Deprecated: The 'cidr_block' field has been deprecated. Please use 'destination' instead.

description This property is required. String
An optional description of your choice for the rule.
destination This property is required. String
Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.
destinationType This property is required. String
Type of destination for the rule. Required if you provide a destination.

  • CIDR_BLOCK: If the rule's destination is an IP address range in CIDR notation.
  • SERVICE_CIDR_BLOCK: If the rule's destination is the cidrBlock value for a Service (the rule is for traffic destined for a particular Service through a service gateway).
networkEntityId This property is required. String
The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.
routeType This property is required. String
A route rule can be STATIC if manually added to the route table, LOCAL if added by Oracle Cloud Infrastructure to the route table.

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.29.0 published on Wednesday, Apr 9, 2025 by Pulumi