Syntax/parsing issue when specifying "spot_instance_types" and "enable_unlimited_credits"
IAXES opened this issue · comments
Overview of the Issue
I am attempting to configure Packer via the AMI/EBS plugin to have a variety of spot instances (T3) with enable_unlimited_credits
and spot_pricing
enabled. This does not work as expected, and yields an error message:
* Error: Instance Type: is not within the supported types for Unlimited credits. Supported instance types are T2, T3, and T4g
Reproduction Steps
I created a minimal build of Ubuntu 20.04 (x86_64), with the following options:
ebs_optimized = true
enable_unlimited_credits = true
spot_price = "auto"
spot_instance_types = [
"t3.medium", "t3.large", "t3.xlarge"
]
Early on, during the Packer build operation, it fails with the following (note the double-space after Error: Instance Type:
; maybe some lookup/indexing function is failing?).
* Error: Instance Type: is not within the supported types for Unlimited credits. Supported instance types are T2, T3, and T4g
If I disable the enabled_unlimited_credits
feature, then the issue goes away. I'd ideally like to use this feature with a pool of T2 and T3 instance types.
Plugin and Packer version
Installed plugin github.com/hashicorp/amazon v1.2.5 in "/home/ubuntu/.config/packer/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_linux_amd64"
2023/05/31 15:22:36 [INFO] Packer version: 1.8.6 [go1.18.9 linux amd64]
Simplified Packer Buildfile
Can't provide at the moment, but I could re-create a "hello world" example later this week, if it helps. If I use the above-noted options in the bug report, plus the boilerplate example from the docs, I can reproduce the issue.
Operating system and Environment details
Linux (in AWS); Intel x86_64, Ubuntu 20.04 LTS.
Hi there, the ability to enable unlimited credits for spot instance type is not currently supported within the plugin. The AWS documentation doesn't recommend enabling unlimited credits for spot instances so it was not added. Currently the plugin only allows for setting enable_unlimited_credits
for a specified instance_type
, which can not be set when using spot_instance_types
. This is why the error message is showing an empty string.
Two things jump out as next steps.
- Add validation for
enable_unlimited_credits
andinstance_type
to ensure an instance_type is set in the config. - Determine if we should add support for
spot_instance_types
, which seems to be the request here.
This issue has been synced to JIRA for planning.
JIRA ID: HPR-1215