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

preserve original IP Address when load balancer is recreated

Open tigermatos opened this issue 2 years ago • 2 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

Would it be possible to have an IP_Address property for oci_load_balancer_load_balancer, to explicitly assign a private IP to the load balancer?
Changes to Load Balancer property that does not support update will force the destruction and recreation of the load balancer, which results in a new IP Address assigned by the system. Then we need to update DNS name resolution, etc. Or perhaps the recreation process could be enhanced to internally lookup the current IP Address first, and then preserve it, by reusing the old IP.

New or Affected Resource(s)

oci_load_balancer_load_balancer and oci_network_load_balancer_network_load_balancer

References

https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/load_balancer_load_balancer

tigermatos avatar Aug 10 '22 17:08 tigermatos

You can already do this. You must create a public IP and pass that in to the load balancer when you create it. Then you can create/destroy the load balancer without losing your public IP. Here's an example extracted from my code:

resource "oci_core_public_ip" "ip" {
  compartment_id = local.compartment_ocid
  display_name   = "${var.name}-public-ip"
  lifetime       = "RESERVED"
  lifecycle {
    prevent_destroy = true
  }
}

resource "oci_network_load_balancer_network_load_balancer" "nlb" {

   ....

  dynamic "reserved_ips" {
    content {
      id = oci_core_public_ip.ip.id
    }
  }
}

There is a bug to be aware of, however. See #1479 . I'm still waiting for an answer to that and using the workaround I posted there.

johnlane avatar Nov 30 '22 09:11 johnlane

Hi, looks like this feature is still not available . The resource "oci_load_balancer_load_balancer" still does not support a dedicated private IP address for private load balancer use case without public IPs. It will require DNS record update everytime the private load balancer is created. Do we have any ETA when this feature will be available ?

mhca99 avatar Apr 26 '24 03:04 mhca99