packer-plugin-googlecompute
packer-plugin-googlecompute copied to clipboard
Add `source_image` to `disk_attachment`
Add ability to specify a source_image in a disk_attachment.
Relevant excerpt from GCP godocs:
// SourceImage: The source image to create this disk. When creating a
// new instance, one of initializeParams.sourceImage or
// initializeParams.sourceSnapshot or disks.source is required except
// for local SSD.
Here's a barebones template that illustrates what we're going for.
source "googlecompute" "image_extra_disk" {
project_id = var.gcp_project_id
zone = var.gcp_zone
source_image_family = var.source_image_family
image_name = var.image_name
disk_attachment {
disk_name = "extra-disk"
device_name = "extra_disk"
source_image = var.extra_disk_source_image_family
volume_type = "pd-standard"
}
image_source_disk = "extra-disk"
}
~I've noticed it's actually creating 3 disks, the boot disk, an extra disk, and then a 3rd disk with the image. Need to fix this up. Converted to draft for now.~
EDIT: Force-pushed to 689fc55. Now creating just 2 just disks as expected.
Hi @adsr thanks for your help in pushing this enhancement forward. It looks like there were just a few suggestions left to address with a rebase to resolve conflicts.
Are you still interested in pushing this PR forward?
Hi @adsr @lbajolet-hashicorp,
We would like to use this feature in our project. Is there smth we can help with? In case we are stuck with this PR, we can open an alternative PR with this feature.
Please, let me know if there is smth we can help with 🙏
Hey @lbajolet-hashicorp, I've merged the latest changes from main into this branch (I work with @adsr). Mind taking another look?
FYI @adsr @ericnorris , I've force-pushed a commit on top of @adsr's original branch to have only one commit to merge and to fold-in a fix on an attribute's name (zone vs. Zone) which had been changed between the original PR and now.
If tests go green with this, we can merge this right after.
Thanks for taking a look and making that fix, sorry I missed it haha.
@lbajolet-hashicorp @JenGoldstrich thanks again for merging this! Are you planning on cutting a release that incorporates this soon?