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

Add more diags on fast-launch enable step #446

Merged
merged 5 commits into from
Dec 20, 2023

Conversation

lbajolet-hashicorp
Copy link
Contributor

Following up on issue #445, this PR adds more diagnostics to the step that enables fast-launch.

Since the wait step only waited for the state to change to either "enabled", "enabled-failed" or "enabling-failed", but later on the code didn't check the state was indeed "enabled", we could end-up in a situation where the fast-launch step failed on AWS, but the plugin would count it as a success.
Note: I couldn't replicate such a scenario in my tests, but this remains a possibility, so I hope the community will someday share a template that we can adapt to ensure the plugin does take this into account.

Also, added some checks to signal the step is being skipped if no AMI's present in the plugin's state bag, as otherwise the step would silently succeed without doing anything.

Finally, we also fix the acceptance tests, as the AMI we picked for them did not exist anymore, and therefore would always fail.

The logic for watiting for fast-launch to enable checks that the state
transitions to either a success or failure state.

While this is not a problem on its own (we don't want to wait
indefinitely for a success if we already errored), we shouldn't treat
the error states as a success, which is what the plugin is doing now.

This commit therefores adds some extra logic to get the status of the
fast-launch for the image, and error if it's not in a 'enabled' state.
The AWS tests with Windows/FastBoot failed because the AMI referenced
was not available anymore (likely deprecated).
To avoid this being a problem in the future, we use the AMI datasource
to get the latest windows server 2016 core English for the test, so we
don't risk the AMI ID being obsolete.
Since the same name was used for multiple tests, only the last one would
produce an output, not each individual test. So to avoid this problem,
we forward the test name we defined for each subtest as the acceptance
test's name, so the logs and configuration are not overwritten.
When the fast launch step runs, it can do nothing if no AMI is found in
state, which may be confusing to users if it succeeds silently and they
didn't expect it.

To avoid this, we add an explicit warning when that happens, as it could
be either due to user input, or a plugin bug, but at least they will
have an idea of what's going on regarding the feature.
@lbajolet-hashicorp lbajolet-hashicorp requested a review from a team as a code owner December 20, 2023 16:01
Copy link
Contributor

@JenGoldstrich JenGoldstrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think we should add a fast launch unit test eventually as I mentioned offline but I don't think its blocking this

@lbajolet-hashicorp lbajolet-hashicorp merged commit 2c98bd9 into main Dec 20, 2023
12 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the error_on_fast_launch_err_state branch December 20, 2023 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants