-
Notifications
You must be signed in to change notification settings - Fork 11
/
gcp.pkr.hcl
100 lines (83 loc) · 1.99 KB
/
gcp.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
packer {
required_plugins {
googlecompute = {
source = "github.com/hashicorp/googlecompute"
version = "~> 1"
}
}
}
variable "account_file" {
type = string
default = null
}
variable "project_id" {
type = string
default = null
}
variable "image_base_name" {
type = string
default = "spacelift-private-worker"
}
variable "image_family" {
type = string
default = "spacelift-private-worker"
}
variable "image_storage_location" {
type = string
default = "us"
}
variable "source_image_family" {
type = string
default = "ubuntu-2004-lts"
}
variable "source_image" {
type = string
default = null
}
variable "suffix" {
type = string
description = "A suffix to add to image names to ensure each version is unique. For example a timestamp or version number."
}
variable "machine_type" {
type = string
default = "n1-standard-2"
}
variable "additional_labels" {
type = map(string)
default = {}
}
variable "zone" {
type = string
default = "us-central1-a"
}
source "googlecompute" "spacelift" {
project_id = var.project_id
source_image_family = var.source_image_family
source_image = var.source_image
ssh_username = "spacelift"
zone = var.zone
disk_size = 50
machine_type = var.machine_type
account_file = var.account_file
image_name = "${var.image_base_name}-${var.image_storage_location}-${var.suffix}"
image_family = var.image_family
image_storage_locations = [var.image_storage_location]
}
build {
sources = ["source.googlecompute.spacelift"]
provisioner "shell" {
scripts = [
"shared/scripts/data-directories.sh",
"shared/scripts/apt-update.sh",
"shared/scripts/apt-install-docker.sh",
"shared/scripts/gvisor.sh",
"shared/scripts/apt-install-jq.sh",
]
env = {
DEBIAN_FRONTEND = "noninteractive"
}
}
post-processor "manifest" {
output = "manifest_gcp.json"
}
}