Skip to main content

DEPRECATION WARNING

OCI has upgraded the DRG (Dynamic Router Gateway) service which simplifies the network architecture with multiple VCNs:

https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/scenario_d.htm#scenariod

Simple utility to insert route rule to OCI Route table

tests

The reason behind this utility is described here: 1251

This simple utility is intended to update the routing table during the terraform run. It inserts the routing rule in an idempotent way (so, it checks first if exact rule is present in routing table).

Examples

The example usage is inside null_resource terraform resource after VCN peering establishment:

resource "null_resource" "right_route_table_update" {
  triggers = {
    rt_id  = data.oci_core_vcn.right_vcn.default_route_table_id
    cidr   = data.oci_core_vcn.left_vcn.cidr_block
    lpg_id = oci_core_local_peering_gateway.right_lpg.id
  }

  provisioner "local-exec" {
    command = "ortu --rt-ocid ${self.triggers.rt_id} --cidr ${self.triggers.cidr} --ne-ocid ${self.triggers.lpg_id}"
  }
  provisioner "local-exec" {
    when    = destroy
    command = "ortu delete --rt-ocid ${self.triggers.rt_id} --cidr ${self.triggers.cidr} --ne-ocid ${self.triggers.lpg_id}"
  }
}

resource "null_resource" "left_route_table_update" {
  triggers = {
    rt_id  = data.oci_core_vcn.left_vcn.default_route_table_id
    cidr   = data.oci_core_vcn.right_vcn.cidr_block
    lpg_id = oci_core_local_peering_gateway.left_lpg.id
  }

  provisioner "local-exec" {
    command = "ortu --rt-ocid ${self.triggers.rt_id} --cidr ${self.triggers.cidr} --ne-ocid ${self.triggers.lpg_id}"
  }
  provisioner "local-exec" {
    when    = destroy
    command = "ortu delete --rt-ocid ${self.triggers.rt_id} --cidr ${self.triggers.cidr} --ne-ocid ${self.triggers.lpg_id}"
  }
}

There is a default route table updated. Don't forget to ignore the route_rules changes for this resource:

resource "oci_core_default_route_table" "default_route_table" {
  manage_default_resource_id = oci_core_vcn.vcn.default_route_table_id

  display_name = var.vcn_name

  freeform_tags = merge(local.default_tags, var.tags)

  lifecycle {
    ignore_changes = [
      route_rules,
    ]
  }
}

resource "null_resource" "default_route_table_update" {
  triggers = {
    rt_id = oci_core_default_route_table.default_route_table.id
    ig_id = oci_core_internet_gateway.internet_gateway.id
    cidr  = local.anywhere
  }

  provisioner "local-exec" {
    command = "ortu --rt-ocid ${self.triggers.rt_id} --cidr ${self.triggers.cidr} --ne-ocid ${self.triggers.ig_id} --debug"
  }
  provisioner "local-exec" {
    when    = destroy
    command = "ortu delete --rt-ocid ${self.triggers.rt_id} --cidr ${self.triggers.cidr} --ne-ocid ${self.triggers.ig_id} --debug"
  }
}

Authentication

I'm using Ansible in my projects, so, this tool relies on ~/.oci/config and OCI_CONFIG_PROFILE environment variable.

In the case of OCI instance usage set the OCI_CLI_AUTH environment variable to instance_principal value.

Metadata

Release files for ortu 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ortu 0.7.0
File Size Uploaded Provenance Actions
ortu-0.7.0.tar.gz 8.0 kB Without provenance Details for ortu-0.7.0.tar.gz

Release files / ortu-0.7.0.tar.gz

Download URL ortu-0.7.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
406b3b7303053edb3b25c054fceae4ef7780d00d9c2afe9edb08e246ec5d8cb5
BLAKE2b-256 checksum
How to use checksums
6a3cbabefa2b42ffa10c272a41efa1e74d7739d2e098c9a6d99cb12f554b6ec0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.12

Security for ortu 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page