digitalocean: Error creating temporary SSH key on packer v.0.12.2 Mac OS X 10.12.3

250 views
Skip to first unread message

Michael Beigelmacher

unread,
Feb 25, 2017, 11:12:34 AM2/25/17
to Packer

I’m going the tutorial on Packer here about parallel builds and the build for a DigitalOcean image fails. First, packer validate example.json fails with:

Template validation failed. Errors are shown below.

Errors validating build 'digitalocean'. 1 error(s) occurred:

* api_token for auth must be specified

Which I worked around by running packer validate -var 'do_api_token=$DO_API_TOKEN' example.json which passed. More importantly, when I run packer build -var 'do_api_token=$DO_API_TOKEN' example.json I get the following error for DigitalOcean

--> digitalocean: Error creating temporary SSH key: POST https://api.digitalocean.com/v2/account/keys: 401 Unable to authenticate you.

I know my DO_API_TOKEN environment variable is correct as it works with other tools (Ansible) without a problem.


Alvaro Miranda Aguilera

unread,
Feb 25, 2017, 11:27:14 AM2/25/17
to packe...@googlegroups.com
hello

not sure what is your host os, but in bash for linux/osx the single quote will avoid the variable expansion

try
packer build -var "do_api_token=${DO_API_TOKEN}" example.json

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/20d846ac-d7cb-41bc-ab87-52cf29669057%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Rickard von Essen

unread,
Feb 25, 2017, 1:24:56 PM2/25/17
to packe...@googlegroups.com
Also if you set DIGITALOCEAN_API_TOKEN packer will use that. I.e. export DIGITALOCEAN_API_TOKEN=$DO_API_TOKEN

If that doesn't work it would be good I'd you attach a log from PACKER_LOG=1 packer build template.json, just redact all sensitive information. 

On Feb 25, 2017 5:27 PM, "Alvaro Miranda Aguilera" <kik...@gmail.com> wrote:
hello

not sure what is your host os, but in bash for linux/osx the single quote will avoid the variable expansion

try
packer build -var "do_api_token=${DO_API_TOKEN}" example.json

Michael Beigelmacher

unread,
Feb 25, 2017, 11:59:07 PM2/25/17
to Packer

Thanks for pointing this out. I mistakenly assumed DO_API_TOKEN (which is used by Ansible) would suffice and didn’t realize Packer required DIGITALOCEAN_API_TOKEN instead.

On Saturday, February 25, 2017 at 1:24:56 PM UTC-5, Rickard von Essen wrote:

Also if you set DIGITALOCEAN_API_TOKEN packer will use that. I.e. export DIGITALOCEAN_API_TOKEN=$DO_API_TOKEN

If that doesn't work it would be good I'd you attach a log from PACKER_LOG=1 packer build template.json, just redact all sensitive information. 
On Feb 25, 2017 5:27 PM, "Alvaro Miranda Aguilera" <kik...@gmail.com> wrote:
hello

not sure what is your host os, but in bash for linux/osx the single quote will avoid the variable expansion

try
packer build -var "do_api_token=${DO_API_TOKEN}" example.json
On Sat, Feb 25, 2017 at 5:12 PM, Michael Beigelmacher <michael.be...@gmail.com> wrote:

I’m going the tutorial on Packer here about parallel builds and the build for a DigitalOcean image fails. First, packer validate example.json fails with:

Template validation failed. Errors are shown below.

Errors validating build 'digitalocean'. 1 error(s) occurred:

* api_token for auth must be specified

Which I worked around by running packer validate -var 'do_api_token=$DO_API_TOKEN' example.json which passed. More importantly, when I run packer build -var 'do_api_token=$DO_API_TOKEN' example.json I get the following error for DigitalOcean

--> digitalocean: Error creating temporary SSH key: POST https://api.digitalocean.com/v2/account/keys: 401 Unable to authenticate you.

I know my DO_API_TOKEN environment variable is correct as it works with other tools (Ansible) without a problem.


--
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...@googlegroups.com.



--
Alvaro

--
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...@googlegroups.com.

Michael Beigelmacher

unread,
Feb 25, 2017, 11:59:58 PM2/25/17
to Packer
Thanks, that did the trick.


On Saturday, February 25, 2017 at 11:27:14 AM UTC-5, Alvaro Miranda Aguilera wrote:
hello

not sure what is your host os, but in bash for linux/osx the single quote will avoid the variable expansion

try
packer build -var "do_api_token=${DO_API_TOKEN}" example.json
On Sat, Feb 25, 2017 at 5:12 PM, Michael Beigelmacher <michael.be...@gmail.com> wrote:

I’m going the tutorial on Packer here about parallel builds and the build for a DigitalOcean image fails. First, packer validate example.json fails with:

Template validation failed. Errors are shown below.

Errors validating build 'digitalocean'. 1 error(s) occurred:

* api_token for auth must be specified

Which I worked around by running packer validate -var 'do_api_token=$DO_API_TOKEN' example.json which passed. More importantly, when I run packer build -var 'do_api_token=$DO_API_TOKEN' example.json I get the following error for DigitalOcean

--> digitalocean: Error creating temporary SSH key: POST https://api.digitalocean.com/v2/account/keys: 401 Unable to authenticate you.

I know my DO_API_TOKEN environment variable is correct as it works with other tools (Ansible) without a problem.


--
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...@googlegroups.com.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages