Closed kral2 closed 3 years ago
How does one now assign a reserved public ip to an instance during first creation time?
According to the Terraform docs oci_core_instance
contains the following fields
create_vnic_details {
#Optional
assign_private_dns_record = var.instance_create_vnic_details_assign_private_dns_record
assign_public_ip = var.instance_create_vnic_details_assign_public_ip
defined_tags = {"Operations.CostCenter"= "42"}
display_name = var.instance_create_vnic_details_display_name
freeform_tags = {"Department"= "Finance"}
hostname_label = var.instance_create_vnic_details_hostname_label
nsg_ids = var.instance_create_vnic_details_nsg_ids
private_ip = var.instance_create_vnic_details_private_ip
skip_source_dest_check = var.instance_create_vnic_details_skip_source_dest_check
subnet_id = oci_core_subnet.test_subnet.id
vlan_id = oci_core_vlan.test_vlan.id
}
and the oci_core_public_ip
resource "oci_core_public_ip" "test_public_ip" {
#Required
compartment_id = var.compartment_id
lifetime = var.public_ip_lifetime
#Optional
defined_tags = {"Operations.CostCenter"= "42"}
display_name = var.public_ip_display_name
freeform_tags = {"Department"= "Finance"}
private_ip_id = oci_core_private_ip.test_private_ip.id
public_ip_pool_id = oci_core_public_ip_pool.test_public_ip_pool.id
}
How does one bind the served IP to the vnic of the instance during creation/after creation. The docs doesn't seem to be clear on this...
i have same problem, how to assign already reserved ip to instance
I also have the same need
Did you figure out how to assign a reserved ip to a compute instance?
Currently, this module supports public ip only on primary vnic and primary IP, using
assign_public_ip
input (boolean).create_vnic_details
block.RESERVED
, it isEPHEMERAL
by default.EPHEMERAL
public IP is already assigned to a vnic, user have to first unassign the public IP before being allowed to attach a new public IP with typeRESERVED
To have the choice of both
RESERVED
andEPHEMERAL
with a consistent user experience, the public IP assignment logic needs to be removed from thecreate_vnic_details
block and promoted as a distinct resource, using oci_core_public_ip.Note: The primary vnic's primary IP OCID will need to get retrieved.