You can either do:

A) packer build -var region=$(aws configure --profile <profile> get region)
template.json

Or (IMHO better)

B) Use the metadata on the instance, see
https://stackoverflow.com/questions/4249488/find-region-from-within-an-ec2-instance

On 7 March 2018 at 18:07, John Mc Quillan <john.mcq1l...@gmail.com> wrote:

> Does anyone know how to get the region from the AWS profile and use it to
> set a user variable so that it can be passed through to provisioners.
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> 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 packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/06f531e6-67ba-44c1-b0db-4594564fa1da%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/06f531e6-67ba-44c1-b0db-4594564fa1da%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt9szYBscFd4aQO5y287n%2BtH%3DeD8Gcn%2Bu1bAqiaxF46Xog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to