Created
May 22, 2023 19:57
-
-
Save nywilken/3f2276c5b202fa42ff14ab8723a5998a 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
variable "project" { | |
type = string | |
default = "${env("GOOGLE_PROJECT_ID")}" | |
} | |
variable "service_account" { | |
type = string | |
default = "${env("GOOGLE_APPLICATION_CREDENTIALS")}" | |
} | |
variable "zone" { | |
type = string | |
default = "us-central1-a" | |
} | |
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } | |
source "googlecompute" "autogenerated_1" { | |
communicator = "ssh" | |
image_name = "packer-template-tester-${local.timestamp}" | |
machine_type = "n1-standard-2" | |
project_id = "${var.project}" | |
source_image_family = "ubuntu-1804-lts" | |
use_os_login = true | |
ssh_username = "packer" | |
zone = "${var.zone}" | |
} | |
build { | |
sources = ["source.googlecompute.autogenerated_1"] | |
provisioner "shell" { | |
execute_command = "sudo -E -S sh '{{ .Path }}'" | |
inline = ["ls /var/bar"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment