-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use reserved public IP when creating instance #1565
Comments
When reserving the public IP, you can assign it to a private IP (from the host). example on how to attach a reserved public IP to the first private IP of a guest:
|
thank you, @dhoogfr ! I appreciate it. I will try that |
I really wish this didn't work like this. Attaching a static IP should be a stand-alone operation. The way this works now creates an unfortunate dependency from the IP to the instance, which in turn means there's no way to inject said public IP into the user data of the instance via Terraform reference. |
@dhoogfr I implemented it and worked for my current use case. |
@OscarB7 To prevent accidental destruction you could try to add a lifecycle clause with "prevent_destroy = true" attribute to the oci_core_public_ip resource
But, I have not actually tried this myself. |
Thank you very much @dhoogfr ! |
I you apply and destroy 5 times , you will probably not reuse the public IP that you prevented from being destroyed. It will be a clutter of public IPs at the end . |
@dhoogfr , I can confirm that the destroy fails with prevent destroy clause .
I am going to open an enhancement issue |
Community Note
Description
I would like to use a reserved public IP for an instance to keep the same IP if the instance is re-created. I can create the reserved public IP with
resource "oci_core_public_ip"
. Now for the instance, the blockresource "oci_core_instance"
does not have an option to attach or associate the existing VNIC.Is there another
resource
block to attach the existing VNIC to the instance? I see the opcion in the OCI web console as explained in this articleNew or Affected Resource(s)
resource "oci_core_instance" could be modified to allow this option. Maybe a new resource to assign and unassign public ip.
Potential Terraform Configuration
A new section that assign a VNIC. This would be the most basic since OCI allows more VNIC.
References
The text was updated successfully, but these errors were encountered: