forked from hashicorp-education/learn-packer-github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.pkr.hcl
57 lines (50 loc) · 1.18 KB
/
build.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
source "amazon-ebs" "ubuntu-lts" {
region = "us-west-1"
source_ami_filter {
filters = {
virtualization-type = "hvm"
name = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
}
owners = ["099720109477"]
most_recent = true
}
instance_type = "t2.small"
ssh_username = "ubuntu"
ssh_agent_auth = false
ami_name = "hashicups_{{timestamp}}"
ami_regions = ["us-west-1"]
}
build {
# HCP Packer settings
hcp_packer_registry {
bucket_name = "learn-packer-github-actions"
description = <<EOT
This is an image for HashiCups.
EOT
bucket_labels = {
"hashicorp-learn" = "learn-packer-github-actions",
}
}
sources = [
"source.amazon-ebs.ubuntu-lts",
]
# systemd unit for HashiCups service
provisioner "file" {
source = "hashicups.service"
destination = "/tmp/hashicups.service"
}
# Set up HashiCups
provisioner "shell" {
scripts = [
"setup-deps-hashicups.sh"
]
}
post-processor "manifest" {
output = "packer_manifest.json"
strip_path = true
custom_data = {
iteration_id = packer.iterationID
}
}
}