hashicorp / hashicorp/packer-plugin-amazon

CHROOT Builder user controlled/defined "manual-mount-command" option to allow for total custom partitioning and mounting procedures

Open
#602 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

#### Community Note

Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) 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.

See PR #603

#### Description

Create a user controlled custom "manual-mount-command" option that when present will run in place of the packer-plugin-amazon's built in mounting steps (pre-mount/mount/post-mount), providing the user total control over partitioning and mounting process. Aligning the chroot builder with similar capabilities to the ebssurrogate builder, allowing for reuse of configs/scripts for each builder with minimal edits. While packer still managing the overall workflow around the interactions with the cloud apis and registering/creating images and abstracting that workflow across the different providers.

#### Use Case(s)

Allows users to use the chroot builder to create an image with an lvm-enabled root volume but also, instead of just targeting LVM, this is a flexible option that supports other complex mounting scenarios.

Much like the ebssurrogate builder supports total user control a "manual-mount-command" will bring this capability to the chroot builder.

We are also working to add this to the packer-plugin-azure chroot builder to support issue: https://github.com/hashicorp/packer-plugin-azure/issues/510

#### Potential configuration
Option: "manual-mount-command": when set, the built in mounting steps are skipped and a new manual mount command step is performed instead.

"manual-mount-command" is a string that will represent the command to run, essentially ensuring the provided script is executable and calling the script.
**Note: mount path and device are still processed in the manual step. If user wants to use the configured/detected devices/mount paths they can reference like the second example.

```
source "amazon-chroot" "manual-mount-example" {
from_scratch = true
...
manual_mount_command = "chmod +x ./scripts/mount.sh && bash -x ./scripts/mount.sh"
}
```
```
source "amazon-chroot" "manual-mount-device-example" {
from_scratch = true
...
manual-mount-command="chmod +x ./scripts/mount.sh && bash -x ./scripts/mount.sh '{{ .Device }}'"
}
```

#### Potential References

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.