terraform-oci-oke icon indicating copy to clipboard operation
terraform-oci-oke copied to clipboard

Refer to LPGs created by the module in the `nat/internet_gateway_route_rules`

Open 12345ieee opened this issue 3 years ago • 9 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

#295 (resolved in #332 ) added the capability to create LPGs in the oke VCN by the use of:

local_peering_gateways  = {lpg1_name = { route_table_id = "", peer_id = "possible_id_of_peered" }}

But it's not possible to refer to these gateways in the nat/internet_gateway_route_rules sections the way it's possible for the predefined drg, nat_gateway, internet_gateway.

This makes it impossible to create fully contained LPG-route networks in the OKE module, as it holds the VCN inside, so one has a chicken-and-egg problem. #467 would solve this from another angle, but the support needed is SO SO close to what we already have.

New or Affected Resource(s)

oci_core_local_peering_gateway
oci_core_route_table

Potential Terraform Configuration

I suggest a configuration similar to the one for drg, nat_gateway, internet_gateway:

  local_peering_gateways  = {lpg1_name = { route_table_id = "", peer_id = "possible_id_of_peered" }}
  nat_gateway_route_rules = [
    {
      destination       = "172.18.0.0/16",
      destination_type  = "CIDR_BLOCK",
      network_entity_id = "nat_gateway",
      description       = "already works, uses the id of the NAT GW created by the OKE module"
    },
    {
      destination       = "172.19.0.0/16",
      destination_type  = "CIDR_BLOCK",
      network_entity_id = "LPG@lpg1_name",
      description       = "this doesn't work right now, the network_entity_id would be the id of the LPG created above"
    }
  ]

References

12345ieee avatar Apr 21 '22 20:04 12345ieee

Hi @12345ieee,

For the network_entity_id value, can you please try passing the LPGs' OCIDs directly?

I would also like to understand your use case better. Can you please elaborate?

hyder avatar Apr 27 '22 04:04 hyder

Hi @hyder ,

I would like to put the LPG ocid there, the issue is that I do not have it until the module runs, because the LPG is created by the module. But I would need the id before the module runs to write it in the inputs, hence the chicken-egg problem.

The drg, nat_gateway, internet_gateway have the same issue, that's why a special string key has been created to represent their id before the module is run, IMHO the same is needed for LPGs.

12345ieee avatar Apr 27 '22 08:04 12345ieee

+@snafuz and @kral2

I thought you can get the module to create the lpgs for you by using the local_peering_gateways variable. Or am I missing something? Can you please help @12345ieee?

hyder avatar Apr 27 '22 14:04 hyder

Oh, but the module absolutely creates the LPGs for me, the issue is in configuring routes to/from said LPGs in the cluster subnets.

12345ieee avatar Apr 27 '22 22:04 12345ieee

@12345ieee I see your point. I've opened a related issue in the vcn module. I'm currently working on improving the whole route rules management to give it more flexibility and will include this change.

snafuz avatar May 02 '22 21:05 snafuz

@12345ieee I created a PR that address your issue, would you be interested to have a look and eventually test it ?

thpham avatar Nov 09 '23 11:11 thpham

Once we've tested it in the VCN module, let's test it here as well just to make sure there's no side effect on existing clusters.

hyder avatar Nov 09 '23 12:11 hyder

I thank you @thpham , but I cannot test it anymore, as I moved to defining the networking outside of the oke module for added flexibility, using the feature added in #467 .

12345ieee avatar Nov 09 '23 12:11 12345ieee

The latest v3.6.0 release of terraform-oci-vcn module, now include the feature, I will prepare a PR here to allow its usage.

thpham avatar Nov 21 '23 16:11 thpham