ITD27M01 / oci-route-table-updater

Route table updater for Oracle Cloud Infrastructure
MIT License
3 stars 0 forks source link

Running ortu delete, deletes all rules associated to DRG network entity #12

Closed Matt-Mcl closed 2 years ago

Matt-Mcl commented 2 years ago

Hi,

I've been using this package with terraform to create route table rules for routing traffic to DRGs. However, when deleting the rules, it deletes all rules in the route table, even ones it hasn't provisioned itself.

Example:

ortu delete --rt-ocid "ocid1.routetable.oc1.uk-london-1.aaaaaaaaexampleocid" --cidr "24.0.0.0/16" --ne-ocid "ocid1.drg.oc1.uk-london-1.bbbbbbbexampleocid"

Running this command deletes the 24.0.0.0/16 rule as well as a 10.0.0.0/16 rule that has been crated manually.

Running the command with --dry-run --debug shows the following output: https://pastebin.com/pVUjtSi6

You can see that it finds the route table containing both rules, but removes both when sending back the updated rules to OCI.

Thank you!

ITD27M01 commented 2 years ago

@Matt-Mcl Hi. It souds really bad. Looks like there is a mistake in rules filtering: https://github.com/ITD27M01/oci-route-table-updater/blob/cc8d87378ed0bfca0ef34c963a1838a9b9fb204a/ortu/oci_route_table.py#L57-L59

Since there can't be two rules for the same CIDR I will leave only check for CIDR but not for network entity.

ITD27M01 commented 2 years ago

@Matt-Mcl Fixed by https://github.com/ITD27M01/oci-route-table-updater/pull/13, please update by pip install ortu --upgrade

Matt-Mcl commented 2 years ago

Just wanted to let you know this works perfectly for me now - Thanks!