[azure] deallocate instead of just power-off

1. allegedly prevents error where  fails because VM still appears running
2. prevents left-behind VM's after failures from accumulating charges
This commit is contained in:
Paul Meyer 2019-01-16 00:31:23 +00:00
parent d344675660
commit e189db97d4
1 changed files with 1 additions and 1 deletions

View File

@ -28,7 +28,7 @@ func NewStepPowerOffCompute(client *AzureClient, ui packer.Ui) *StepPowerOffComp
}
func (s *StepPowerOffCompute) powerOffCompute(ctx context.Context, resourceGroupName string, computeName string) error {
f, err := s.client.VirtualMachinesClient.PowerOff(ctx, resourceGroupName, computeName)
f, err := s.client.VirtualMachinesClient.Deallocate(ctx, resourceGroupName, computeName)
if err == nil {
err = f.WaitForCompletion(ctx, s.client.VirtualMachinesClient.Client)
}