Skip to content
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

documentation discrepancy in resource oci_core_private_ip #2100

Open
mhca99 opened this issue Apr 25, 2024 · 0 comments
Open

documentation discrepancy in resource oci_core_private_ip #2100

mhca99 opened this issue Apr 25, 2024 · 0 comments
Labels

Comments

@mhca99
Copy link

mhca99 commented Apr 25, 2024

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

Terraform Version and Provider Version

Terraform v1.7.3
on linux_amd64

  • provider registry.terraform.io/oracle/oci v5.39.0

Affected Resource(s)

oci_core_private_ip

Terraform Configuration Files

resource "oci_core_private_ip" "float_private_ip" {

  display_name   = "testvm-floatip"
  hostname_label = "testvm-floatip"
  ip_address     = "192.168.2.102"

}

Debug Output

│ Error: 400-MissingParameter, This request is missing one of the following arguments: subnetId, vnicId, vlanId.
│ Suggestion: Please retry or contact support for help with service: Core Private Ip
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/core_private_ip
│ API Reference: https://docs.oracle.com/iaas/api/#/en/iaas/20160918/PrivateIp/CreatePrivateIp
│ Request Target: POST https://iaas.ca-toronto-1.oraclecloud.com/20160918/privateIps
│ Provider version: 5.39.0, released on 2024-04-24.
│ Service: Core Private Ip
│ Operation Name: CreatePrivateIp

Panic Output

Expected Behavior

It should have created a private IP.

Actual Behavior

As per documentation , the vnic_id field is optional , however , its throwing error with missing vnicId . Further documentation does not reference any subnet_id , however its complaining about missing subnetId . When I tried to use the subnet_id , this resource does not recognize this field either.
This documentation needs to be corrected , further we have a use case where we first deploy the infrastructure including the VCN, subnets and Route tables via main pipeline and then deploy the firewall VMs via separate pipeline. In main pipeline code, we require Route Table entry with firewall IP as next hop to force traffic through the firewall. This entry requires IP OCID which is not available during the first run as FW is not deployed yet. We wanted to use oci_core_private_ip to create the IP and inject its OCID in the routing table before deploying the firewall. And for the firewall VM, we wanted to use this IP in the "oci_core_vnic_attachment" resource , however it looks like that resource does not support attaching pre-existing IP (for that we will open another ticket/case).
In a nutshell , we should be able to create an IP that later we can attach to existing or new NIC interface as Secondary IP.

Steps to Reproduce

  1. create VM with private IP resource with following code:
resource "oci_core_instance" "vm" {

  availability_domain = var.availability_domain_name
  compartment_id      = var.compute_compartment_ocid
  display_name        = "testvm"
  shape               = "VM.Standard.E4.Flex"

  shape_config {

    ocpus         = "4"
    memory_in_gbs = "4"
  }


  create_vnic_details {
    subnet_id              = var.vm-subnet
    display_name           = "testvm-main-nic"
    assign_public_ip       = false
    skip_source_dest_check = false
    hostname_label         = "testvm-vol1"
    private_ip             = "192.168.2.100"
  }

  source_details {
    source_type = "image"
    source_id   = var.image-id
  }

  timeouts {
    create = "60m"
  }
}


resource "oci_core_vnic_attachment" "vnic_attach_test" {

  instance_id  = oci_core_instance.vm.id
  display_name = "testvm-nic1-attchment"

  create_vnic_details {
    subnet_id              = var.vm-subnet
    display_name           = "testvm-nic1"
    hostname_label         = "testvm-nic1"
    assign_public_ip       = false
    skip_source_dest_check = true
    private_ip             = "192.168.2.101"

  }


}

resource "oci_core_private_ip" "float_private_ip" {

  display_name   = "testvm-floatip"
  hostname_label = "testvm-floatip"
  ip_address     = "192.168.2.102"

}


resource "oci_core_volume" "vm_volume" {
  availability_domain = var.availability_domain_name
  compartment_id      = var.compute_compartment_ocid
  display_name        = "testvm-osdisk1"
  size_in_gbs         = "50"

}

resource "oci_core_volume_attachment" "vm_volume_attach" {
  attachment_type = "paravirtualized"
  instance_id     = oci_core_instance.vm.id
  volume_id       = oci_core_volume.vm_volume.id
}

  1. terraform apply

Important Factoids

References

@mhca99 mhca99 added the bug label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant