I am trying to create a rule in the existing Default Route Table in OCI using terraform.
Basically I am trying to add a rule for internet gateway so I can access it using ssh. not sure but I am not able to access TCP till I am not adding rule in default table, new table not working for me..
But In OCI provider the option is available for only create new route table with rule instead of add rule in existing / default route table
I am just able to find below option for route table in oci provider, the rest belongs to DRG.
https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_route_table
I am currently using below terraform code:
resource "oci_core_internet_gateway" "test_internet_gateway" {
#Required
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.test_vcn.id
}
resource "oci_core_route_table" "test_route_table" {
#Required
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.test_vcn.id
#display_name = "Default Route Table for xyz"
route_rules {
#Required
network_entity_id = oci_core_internet_gateway.test_internet_gateway.id
#cidr_block = "0.0.0.0/0"
destination = "0.0.0.0/0"
}
}
Any way around or solution will helps !!!!
The displayed terraform code creates a Route Table and adds a route rule for 0.0.0.0/0. The missing piece is to map this Route Table to the subnet that is housing your VM.
Here are a couple of thoughts:
Lastly, please check this page to know about how to modify Default Resources. This could be your quick win.