hetznercloud / packer-plugin-hcloud

Packer plugin for Hetzner Cloud Builder
https://developer.hashicorp.com/packer/integrations/hetznercloud/hcloud
Mozilla Public License 2.0
22 stars 21 forks source link

Attach Hetzner volume #79

Closed Lyannic closed 12 months ago

Lyannic commented 1 year ago

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request. If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

It would be helpful to be able to attach a Hetzner volume to the server that is running the Packer build.

Use Case(s)

When you use Packer, you want to build immutable infrastructure. So you generally have your persisted data somewhere outside of the actual server so that it doesn't get lost when you deploy/build a new image. This is often done, by simply having a separate database server. But there is also the use case where you just store your data that needs to be persisted, into a cloud volume. If you do that, the volume needs to be mounted to the image building server, because you want to handle the mounting of the volume during the build of the image. You also don't want to loose the data that gets persisted at the application startup. Application startup typically happens during the build of the image and a typical task would be database initialization/migration.

Potential configuration

Attaching the volume could for example just be configured when describing the source

source "hcloud" "name" {
  image   = "ubuntu"
  ...
  volumes = [ <volume_id> ]
}

Potential References

The Amazon EBS builder offers this functionality as launch_block_device_mappings

Lyannic commented 12 months ago

I just realized that this doesn't really make sense. When building a new Packer image, you would need to detach the cloud volume from the currently running server and attach it to the Packer building server. This would lead to downtime and isn't really practical.