Created
February 22, 2021 23:37
-
-
Save jbielick/8a6c82bf0ce82d71ee7902751af10222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "googlecompute" "sftp" { | |
project_id = "my-project" | |
source_image_family = "debian-10" | |
ssh_username = "packer" | |
machine_type = "n1-standard-2" | |
disk_size = 50 | |
zone = "us-east1-d" | |
subnetwork = "default" | |
image_name = "sftp-{{timestamp}}" | |
} | |
build { | |
sources = ["sources.googlecompute.sftp"] | |
provisioner "file" { | |
source = "files/hostkeys.tar.gz" | |
destination = "/tmp/hostkeys.tar.gz" | |
} | |
provisioner "shell" { | |
execute_command = "echo 'packer' | sudo -S env {{ .Vars }} {{ .Path }}" | |
inline = [ | |
"tar -zxpf /tmp/hostkeys.tar.gz --directory /etc/ssh/", | |
"chown -R root:root /etc/ssh/" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment