diff --git a/builder/googlecompute/step_check_existing_image.go b/builder/googlecompute/step_check_existing_image.go index 171e503ce..8d43c98c1 100644 --- a/builder/googlecompute/step_check_existing_image.go +++ b/builder/googlecompute/step_check_existing_image.go @@ -19,14 +19,15 @@ func (s *StepCheckExistingImage) Run(state multistep.StateBag) multistep.StepAct if !c.PackerForce { ui.Say("Checking image does not exist...") - c.imageAlreadyExists = d.ImageExists(c.ImageName) - if c.imageAlreadyExists { - err := fmt.Errorf("Image %s already exists.\n"+ - "Use the force flag to delete it prior to building.", c.ImageName) - state.Put("error", err) - ui.Error(err.Error()) - return multistep.ActionHalt - } + } + + c.imageAlreadyExists = d.ImageExists(c.ImageName) + if !c.PackerForce && c.imageAlreadyExists { + err := fmt.Errorf("Image %s already exists.\n"+ + "Use the force flag to delete it prior to building.", c.ImageName) + state.Put("error", err) + ui.Error(err.Error()) + return multistep.ActionHalt } return multistep.ActionContinue }