Skip to content

Commit

Permalink
Log when skipping instance stop for spot instances
Browse files Browse the repository at this point in the history
This should make it clearer what's going on.

Also update the documentation to mention this behavior.

Closes hashicorp#448.
  • Loading branch information
legoscia committed Oct 30, 2024
1 parent e79e7b8 commit ed447fd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .web-docs/components/builder/ebs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ JSON example:
-> Note: The double quotation marks in the command are not required if
your CMD shell is already in the
`C:\Program Files\Amazon\EC2ConfigService\` directory.

Note that when using a spot instance, Packer doesn't stop the instance,
regardless of the value of this setting. Instead, it relies on the CreateImage
call to stop and restart the instance.

- `ebs_optimized` (bool) - Mark instance as [EBS
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
Expand Down
4 changes: 4 additions & 0 deletions .web-docs/components/builder/ebssurrogate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ JSON example:
-> Note: The double quotation marks in the command are not required if
your CMD shell is already in the
`C:\Program Files\Amazon\EC2ConfigService\` directory.

Note that when using a spot instance, Packer doesn't stop the instance,
regardless of the value of this setting. Instead, it relies on the CreateImage
call to stop and restart the instance.

- `ebs_optimized` (bool) - Mark instance as [EBS
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
Expand Down
4 changes: 4 additions & 0 deletions .web-docs/components/builder/ebsvolume/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concept
-> Note: The double quotation marks in the command are not required if
your CMD shell is already in the
`C:\Program Files\Amazon\EC2ConfigService\` directory.

Note that when using a spot instance, Packer doesn't stop the instance,
regardless of the value of this setting. Instead, it relies on the CreateImage
call to stop and restart the instance.

- `ebs_optimized` (bool) - Mark instance as [EBS
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
Expand Down
4 changes: 4 additions & 0 deletions .web-docs/components/builder/instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ JSON example:
-> Note: The double quotation marks in the command are not required if
your CMD shell is already in the
`C:\Program Files\Amazon\EC2ConfigService\` directory.

Note that when using a spot instance, Packer doesn't stop the instance,
regardless of the value of this setting. Instead, it relies on the CreateImage
call to stop and restart the instance.

- `ebs_optimized` (bool) - Mark instance as [EBS
Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
Expand Down
4 changes: 4 additions & 0 deletions builder/common/run_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ type RunConfig struct {
// -> Note: The double quotation marks in the command are not required if
// your CMD shell is already in the
// `C:\Program Files\Amazon\EC2ConfigService\` directory.
//
// Note that when using a spot instance, Packer doesn't stop the instance,
// regardless of the value of this setting. Instead, it relies on the CreateImage
// call to stop and restart the instance.
DisableStopInstance bool `mapstructure:"disable_stop_instance" required:"false"`
// Mark instance as [EBS
// Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
Expand Down
1 change: 1 addition & 0 deletions builder/common/step_stop_ebs_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (s *StepStopEBSBackedInstance) Run(ctx context.Context, state multistep.Sta

// Skip when it is a spot instance
if s.Skip {
ui.Say("Skipping instance stop, since this is a spot instance.")
return multistep.ActionContinue
}

Expand Down
4 changes: 4 additions & 0 deletions docs-partials/builder/common/RunConfig-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
-> Note: The double quotation marks in the command are not required if
your CMD shell is already in the
`C:\Program Files\Amazon\EC2ConfigService\` directory.

Note that when using a spot instance, Packer doesn't stop the instance,
regardless of the value of this setting. Instead, it relies on the CreateImage
call to stop and restart the instance.

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

0 comments on commit ed447fd

Please sign in to comment.