This commit moves the Amazon builders of Packer away from the Hashicorp
fork of the goamz library to the official AWS SDK for Go, in order that
third party plugins may depend on the more complete official library
more easily.
Relates to #1539
AWS is eventually consistent and instance can be not visibile for
some time after creation. This fix eliminates describe-instances
call before going to the proper wait loop
- help resolve https://github.com/mitchellh/packer/issues/1533
(although timeouts are always ultimately useless in a distributed
system!)
- makes packer no more idempotent or janitorial than before
- derive maximum number of ticks from timeout
- default timeout to 300s (5m) to cater for global AMI copying
- allow user to override with AWS_TIMEOUT_SECONDS environment variable
Given that state fetching is an idempotent operation, a transient
network error should not cause the entire build to fail. Instead,
retry when such errors are encountered.
It is possible for an instance to not immediately exist after it is
launched. Previously, InstanceStateRefreshFunc would crash if this race
condition were realized.
This change takes the exact same approach of the function above,
AMIStateRefreshFunc, treating 'InvalidInstanceID.NotFound' as if there
were an empty result.