Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: validate capacity reservation options #483

Merged
merged 1 commit into from
May 24, 2024

Conversation

lbajolet-hashicorp
Copy link
Contributor

The capacity reservation options (ID, ARN, or Preference) are all mutually exclusive, only one of the three should be set in a given configuration.

The code wasn't enforcing this, leading to cases in which conflicts could be specified in the configuration, and the call to start the instance would then fail during build instead of before it starts.

This commit adds some logic to ensure that only valid options are accepted, and some tests are added to make sure these options cannot conflict.

Closes #473

@lbajolet-hashicorp lbajolet-hashicorp requested a review from a team as a code owner May 23, 2024 20:21
builder/common/run_config.go Outdated Show resolved Hide resolved
The capacity reservation options (ID, ARN, or Preference) are all
mutually exclusive, only one of the three should be set in a given
configuration.

The code wasn't enforcing this, leading to cases in which conflicts
could be specified in the configuration, and the call to start the
instance would then fail during build instead of before it starts.

This commit adds some logic to ensure that only valid options are
accepted, and some tests are added to make sure these options cannot
conflict.
@lbajolet-hashicorp lbajolet-hashicorp force-pushed the capacity_config_checks_and_default branch from 435a914 to cac4d34 Compare May 24, 2024 17:45
@lbajolet-hashicorp lbajolet-hashicorp merged commit a89fa76 into main May 24, 2024
12 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the capacity_config_checks_and_default branch May 24, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Encountered When Building AMI with capacity_reservation_id
2 participants