Skip EBS AMI preparation when no image is created#681
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
0399c74 to
9fa7987
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Amazon EBS builder workflow so that when skip_create_ami is enabled, AMI-preparation steps (stopping the source instance and modifying source instance attributes) are skipped instead of running before AMI creation is bypassed.
Changes:
- Plumbs
AMISkipCreateImageinto the EBS builder’s source-instance stop and attribute-modification steps. - Adds early-exit behavior in the stop/modify steps to skip work when
skip_create_amiis set. - Adds unit tests covering the new early-exit behavior for both SDK v2 (
common/) and SDK v1 (builder/common/) step implementations.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
common/step_stop_ebs_instance.go |
Skips stopping the source instance when AMISkipCreateImage is true. |
common/step_stop_ebs_instance_test.go |
Adds a test ensuring stop is skipped when skip_create_ami is set. |
common/step_modify_ebs_instance.go |
Skips source instance attribute modification when AMISkipCreateImage is true. |
common/step_modify_ebs_instance_test.go |
Adds a test ensuring modification is skipped when skip_create_ami is set. |
builder/ebs/builder.go |
Passes AMISkipCreateImage into the stop/modify steps in the EBS builder step chain. |
builder/common/step_stop_ebs_instance.go |
Mirrors skip behavior for the SDK v1 step implementation. |
builder/common/step_stop_ebs_instance_test.go |
Adds a test ensuring stop is skipped (SDK v1 implementation). |
builder/common/step_modify_ebs_instance.go |
Mirrors skip behavior for the SDK v1 modification step. |
builder/common/step_modify_ebs_instance_test.go |
Adds a test ensuring modification is skipped (SDK v1 implementation). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
617d89c to
30a79ad
Compare
30a79ad to
207d5b5
Compare
Description
This changes the Amazon EBS builder so
skip_create_ami = truealso reaches the source instance AMI preparation steps.Today those steps can still stop the source instance and modify source instance attributes before the create image step observes
skip_create_ami. For no image builds, I think those steps are AMI preparation work and can be skipped.The patch passes
skip_create_amiinto:StepStopEBSBackedInstanceStepModifyEBSBackedInstanceThis PR intentionally does not change the final source instance termination wait. That behavior is a separate cleanup concern and can be discussed independently.
Resolved Issues
Closes #680
Evidence
I tested this with no image Amazon EBS runs that collect outputs before cleanup.
Full no image EBS run on
c5.metalwith Amazon plugin1.8.1The source instance stop wait took about
19m16s.Local patch that skips source stop and source attribute preparation
Packer logged that source instance stop was skipped when
skip_create_ami = true.The remaining cleanup wait moved to final termination, which is why this PR avoids addressing that separate behavior.
Validation
go test ./builder/common ./common ./builder/ebsRollback Plan
Revert this change.
Changes to Security Controls
No. This does not change access controls, encryption, or logging.