» oci_core_route_table

This resource provides the Route Table resource in Oracle Cloud Infrastructure Core service.

Creates a new route table for the specified VCN. In the request you must also include at least one route rule for the new route table. For information on the number of rules you can have in a route table, see Service Limits. For general information about route tables in your VCN and the types of targets you can use in route rules, see Route Tables.

For the purposes of access control, you must provide the OCID of the compartment where you want the route table to reside. Notice that the route table doesn't have to be in the same compartment as the VCN, subnets, or other Networking Service components. If you're not sure which compartment to use, put the route table in the same compartment as the VCN. For more information about compartments and access control, see Overview of the IAM Service. For information about OCIDs, see Resource Identifiers.

You may optionally specify a display name for the route table, otherwise a default is provided. It does not have to be unique, and you can change it. Avoid entering confidential information.

For more information on configuring a VCN's default route table, see Managing Default VCN Resources

» Example Usage

resource "oci_core_route_table" "test_route_table" {
    #Required
    compartment_id = "${var.compartment_id}"
    vcn_id = "${oci_core_vcn.test_vcn.id}"

    #Optional
    defined_tags = {"Operations.CostCenter"= "42"}
    display_name = "${var.route_table_display_name}"
    freeform_tags = {"Department"= "Finance"}
    route_rules {
        #Required
        network_entity_id = "${oci_core_internet_gateway.test_internet_gateway.id}"

        #Optional
        cidr_block = "${var.route_table_route_rules_cidr_block}"
        destination = "${var.route_table_route_rules_destination}"
        destination_type = "${var.route_table_route_rules_destination_type}"
    }
}

» Argument Reference

The following arguments are supported:

  • compartment_id - (Required) (Updatable) The OCID of the compartment to contain the route table.
  • defined_tags - (Optional) (Updatable) 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 - (Optional) (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
  • freeform_tags - (Optional) (Updatable) 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"}
  • route_rules - (Optional) (Updatable) The collection of rules used for routing destination IPs to network devices.

    • cidr_block - (Optional) (Updatable) Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

      A destination IP address range in CIDR notation. Matching packets will be routed to the indicated network entity (the target).

      Cannot be an IPv6 CIDR.

      Example: 0.0.0.0/0

    • destination - (Optional) (Updatable) Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.

      Allowed values:

      • IP address range in CIDR notation. Can be an IPv4 or IPv6 CIDR. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56. If you set this to an IPv6 CIDR, the route rule's target can only be a DRG or internet gateway. Note that IPv6 addressing is currently supported only in the Government Cloud.
      • The cidrBlock value for a Service, if you're setting up a route rule for traffic destined for a particular Service through a service gateway. For example: oci-phx-objectstorage.
    • destination_type - (Optional) (Updatable) 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 - (Required) (Updatable) The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.

  • vcn_id - (Required) The OCID of the VCN the route table belongs to.

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

» Attributes Reference

The following attributes are exported:

  • compartment_id - The OCID of the compartment containing the route table.
  • defined_tags - 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 - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
  • freeform_tags - 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 - The route table's Oracle ID (OCID).
  • route_rules - The collection of rules for routing destination IPs to network devices.

    • cidr_block - Deprecated. Instead use destination and destinationType. Requests that include both cidrBlock and destination will be rejected.

      A destination IP address range in CIDR notation. Matching packets will be routed to the indicated network entity (the target).

      Cannot be an IPv6 CIDR.

      Example: 0.0.0.0/0

    • destination - Conceptually, this is the range of IP addresses used for matching when routing traffic. Required if you provide a destinationType.

      Allowed values:

      • IP address range in CIDR notation. Can be an IPv4 or IPv6 CIDR. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56. If you set this to an IPv6 CIDR, the route rule's target can only be a DRG or internet gateway. Note that IPv6 addressing is currently supported only in the Government Cloud.
      • The cidrBlock value for a Service, if you're setting up a route rule for traffic destined for a particular Service through a service gateway. For example: oci-phx-objectstorage.
    • destination_type - 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 - The OCID for the route rule's target. For information about the type of targets you can specify, see Route Tables.

  • state - The route table's current state.

  • time_created - The date and time the route table was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

  • vcn_id - The OCID of the VCN the route table list belongs to.

» Import

RouteTables can be imported using the id, e.g.

$ terraform import oci_core_route_table.test_route_table "id"