Skip to content

Commit ed447fd

Browse files
committed
Log when skipping instance stop for spot instances
This should make it clearer what's going on. Also update the documentation to mention this behavior. Closes hashicorp#448.
1 parent e79e7b8 commit ed447fd

File tree

7 files changed

+25
-0
lines changed

7 files changed

+25
-0
lines changed

.web-docs/components/builder/ebs/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,10 @@ JSON example:
581581
-> Note: The double quotation marks in the command are not required if
582582
your CMD shell is already in the
583583
`C:\Program Files\Amazon\EC2ConfigService\` directory.
584+
585+
Note that when using a spot instance, Packer doesn't stop the instance,
586+
regardless of the value of this setting. Instead, it relies on the CreateImage
587+
call to stop and restart the instance.
584588

585589
- `ebs_optimized` (bool) - Mark instance as [EBS
586590
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

.web-docs/components/builder/ebssurrogate/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ JSON example:
594594
-> Note: The double quotation marks in the command are not required if
595595
your CMD shell is already in the
596596
`C:\Program Files\Amazon\EC2ConfigService\` directory.
597+
598+
Note that when using a spot instance, Packer doesn't stop the instance,
599+
regardless of the value of this setting. Instead, it relies on the CreateImage
600+
call to stop and restart the instance.
597601

598602
- `ebs_optimized` (bool) - Mark instance as [EBS
599603
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

.web-docs/components/builder/ebsvolume/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concept
546546
-> Note: The double quotation marks in the command are not required if
547547
your CMD shell is already in the
548548
`C:\Program Files\Amazon\EC2ConfigService\` directory.
549+
550+
Note that when using a spot instance, Packer doesn't stop the instance,
551+
regardless of the value of this setting. Instead, it relies on the CreateImage
552+
call to stop and restart the instance.
549553

550554
- `ebs_optimized` (bool) - Mark instance as [EBS
551555
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

.web-docs/components/builder/instance/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ JSON example:
579579
-> Note: The double quotation marks in the command are not required if
580580
your CMD shell is already in the
581581
`C:\Program Files\Amazon\EC2ConfigService\` directory.
582+
583+
Note that when using a spot instance, Packer doesn't stop the instance,
584+
regardless of the value of this setting. Instead, it relies on the CreateImage
585+
call to stop and restart the instance.
582586

583587
- `ebs_optimized` (bool) - Mark instance as [EBS
584588
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

builder/common/run_config.go

+4
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ type RunConfig struct {
178178
// -> Note: The double quotation marks in the command are not required if
179179
// your CMD shell is already in the
180180
// `C:\Program Files\Amazon\EC2ConfigService\` directory.
181+
//
182+
// Note that when using a spot instance, Packer doesn't stop the instance,
183+
// regardless of the value of this setting. Instead, it relies on the CreateImage
184+
// call to stop and restart the instance.
181185
DisableStopInstance bool `mapstructure:"disable_stop_instance" required:"false"`
182186
// Mark instance as [EBS
183187
// Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

builder/common/step_stop_ebs_instance.go

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func (s *StepStopEBSBackedInstance) Run(ctx context.Context, state multistep.Sta
2828

2929
// Skip when it is a spot instance
3030
if s.Skip {
31+
ui.Say("Skipping instance stop, since this is a spot instance.")
3132
return multistep.ActionContinue
3233
}
3334

docs-partials/builder/common/RunConfig-not-required.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
-> Note: The double quotation marks in the command are not required if
6363
your CMD shell is already in the
6464
`C:\Program Files\Amazon\EC2ConfigService\` directory.
65+
66+
Note that when using a spot instance, Packer doesn't stop the instance,
67+
regardless of the value of this setting. Instead, it relies on the CreateImage
68+
call to stop and restart the instance.
6569

6670
- `ebs_optimized` (bool) - Mark instance as [EBS
6771
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).

0 commit comments

Comments
 (0)