Packer get instance_id in a variable

Skip to first unread message

Svetlio Shushkov

Jun 8, 2021, 3:04:14 PMJun 8
to Packer
Hi All,

I am using oracle-oci builder to create the instance and the image afterwards, but in between these two, I need to apply some configuration using ansible.

I would like to let ansible know the instance that it needs to do this to (local ansible), since I need to attach a block volume to it.

Is there a normal way of obtaining this information from either packer or the builder or any other way, so that I can configure the instance?


Wilken Rivera

Jun 9, 2021, 10:21:35 AMJun 9
Hi there, 

Packer does provide a way for providing the instance id to provisioners using build variables. However, these build variables do vary by builder type as it is on the builder to set the value. If the oracle-oci builder offers access to the instance id you can reference it via ${build.ID} for HCL2 templates or {{build `ID`}} in JSON templates. 

Is the instance ID the information you are looking for?

There are additional build variables such as HOST, Password, etc.
I would suggest giving the build variable a try and seeing if it contains the information you are looking for.

Wilken Rivera <>

This mailing list is governed under the HashiCorp Community Guidelines - Behavior in violation of those guidelines may result in your removal from this mailing list.
IRC: #packer-tool on Freenode
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

Svetlio Shushkov

Jun 24, 2021, 9:04:22 AMJun 24
to Packer
Hey guys,

Thanks for letting me know of this, I wasn't paying attention to those variables.
Thanks again :)

Reply all
Reply to author
0 new messages