Packer: OCI private network instance access issue

Created on 17 Aug 2020  ยท  2Comments  ยท  Source: hashicorp/packer

Overview of the Issue

On-premises environment has private OCI network attached. Service gateways are enabled for accessing the OCI services (e.g.: used for accessing the Oracle image repositories). Packer instantiates the image correctly at the selected compartment, but tries to retrieve the virtual machine's public IP. Since packer fails to get the public IP, it kindly refuses to carry on the process using the machine's private IP.

Reproduction Steps

  1. Create an OCI VCN (virtual cloud network) with a private subnet.
  2. Try to create a custom image with packer using that network with just writing some content into a file.

Packer version

$ packer -v
1.6.1

Simplified Packer Buildfile

{
  "builders": [
    {
      "user_ocid": "==custom value==",
      "tenancy_ocid": "==custom value==",
      "fingerprint": "==custom value==",
      "key_file": "==custom value==",
      "availability_domain": "==custom value==",
      "region": "==custom value==",
      "base_image_ocid": "==custom value==",
      "compartment_ocid": "==custom value==",

      "image_name": "CustomTestImageOCI",
      "shape": "VM.Standard1.1",
      "ssh_username": "opc",
      "subnet_ocid": "ocid1.xxxx",
      "type": "oracle-oci"

    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "sleep 30",
        "echo x > tmp/test.txt"
      ]
    }
  ]
}

Operating system and Environment details

  • Machine where packer runs: CENTOS 7
  • Image used for custom virtual machine image creation is the default Oracle Linux image.

Log Fragments and crash.log files

$ packer build template.json
oracle-oci: output will be in this color.

==> oracle-oci: Creating temporary ssh key for instance...
==> oracle-oci: Creating instance...
==> oracle-oci: Created instance (ocid1.xxxx).
==> oracle-oci: Waiting for instance to enter 'RUNNING' state...
==> oracle-oci: Instance 'RUNNING'.
==> oracle-oci: Error getting instance's IP: Error getting VNIC Public Ip for: ocid1.xxxx
==> oracle-oci: Terminating instance (ocid1.xxxx)...
==> oracle-oci: Terminated instance.
Build 'oracle-oci' errored: Error getting instance's IP: Error getting VNIC Public Ip for: ocid1.xxxx

==> Some builds didn't complete successfully and had errors:
--> oracle-oci: Error getting instance's IP: Error getting VNIC Public Ip for: ocid1.xxxx

==> Builds finished but no artifacts were created.
bug

Most helpful comment

Sorry, my bad. I missed the "use_private_ip" flag.

All 2 comments

Sorry, my bad. I missed the "use_private_ip" flag.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings