Commit 4773b487 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazon/chroot: delete the EBS volume after we're done

parent 3a416bb1
......@@ -63,4 +63,17 @@ func (s *StepCreateVolume) Run(state map[string]interface{}) multistep.StepActio
return multistep.ActionContinue
}
func (s *StepCreateVolume) Cleanup(map[string]interface{}) {}
func (s *StepCreateVolume) Cleanup(state map[string]interface{}) {
if s.volumeId == "" {
return
}
ec2conn := state["ec2"].(*ec2.EC2)
ui := state["ui"].(packer.Ui)
ui.Say("Deleting the created EBS volume...")
_, err := ec2conn.DeleteVolume(s.volumeId)
if err != nil {
ui.Error(fmt.Sprintf("Error deleting EBS volume: %s", err))
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment