digitalocean / packer-plugin-digitalocean

Packer plugin for DigitalOcean Builder
https://developer.hashicorp.com/packer/integrations/digitalocean/digitalocean
Mozilla Public License 2.0
22 stars 13 forks source link

Add option to skip snapshot creation #133

Open amoralesc opened 6 months ago

amoralesc commented 6 months ago

Description

The DigitalOcean builder could have an option to skip the snapshot creation.

Other builders like the AWS and GCP one already implement this, with the skip_create_ami and skip_create_image configuration options respectively.

Use Case(s)

This behavior would be useful in CI/CD environments, where we could test that an image configuration is valid in a pipeline, without actually creating the resource on DigitalOcean. Current alternatives require calling the DigitalOcean API to delete the snapshot after the long-running create snapshot and transfer snapshot steps are done.

Potential configuration

source "digitalocean" "example" {
  api_token            = "YOUR API KEY"
  image                = "ubuntu-22-04-x64"
  region               = "nyc3"
  size                 = "s-1vcpu-1gb"
  ssh_username         = "root"
  # new option
  skip_create_snapshot = true
}

Potential References

AWS and GCP builders do it on the step_create_*.go files, which seem equivalent to the step_snapshot.go in this repository.