Closed satya-kotari closed 5 months ago
Hey @satya-kotari,
Sorry I've not answered your issue earlier, missed it entierly.
This does look like a bug, I'll take a look at the plugin ASAP, and if it is indeed a bug on our end, I'll try to push a fix then.
Thanks for reporting this!
Hi @satya-kotari,
I've opened a PR that should address your case, I've added a bunch of unit tests for Prepare, but I'm a firm believer in real-life testing :)
Would you be able to build the plugin and test building your configuration with it? If the change I made works, I believe this should fix your issue, but please let me know if this is really the case.
Thanks in advance!
Error Encountered When Building AMI with capacity_reservation_id
I'm currently attempting to utilize the capacity_reservation_id attribute in Packer to launch the template. However, I keep encountering the following error: _Build 'amazon-ebs.autogenerated1' errored after 1 second 875 milliseconds: Error launching source instance: InvalidParameterCombination: The request can include either a CapacityReservationId or a CapacityReservationPreference but not both.
Reproduction Steps
Steps to reproduce this issue
Packer version
1.10.2
Simplified Packer Template
The problem lies in the code block between lines 890 and 892 of the following file: https://github.com/hashicorp/packer-plugin-amazon/blob/01cd50e05c90d905af09cc298b24011ec3227cd9/builder/common/run_config.go. Ideally, we shouldn't set it to "none" because doing so disables the use of the capacity_reservation_id. According to AWS, we can only pass one parameter in this scenario. Ref: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CapacityReservationSpecification.html
Any help would be much appreciated.
Thank you!