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.
$ packer -v
1.6.1
{
"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"
]
}
]
}
$ 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.
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.
Most helpful comment
Sorry, my bad. I missed the "use_private_ip" flag.