-
Notifications
You must be signed in to change notification settings - Fork 1
/
macami.pkr.hcl
125 lines (106 loc) · 2.91 KB
/
macami.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
packer {
required_version = "= 1.12.0"
required_plugins {
amazon = {
source = "github.com/inloco/amazon"
version = "= 1.3.3"
}
}
}
variable "aws_region" {
default = env("AWS_REGION")
validation {
condition = length(var.aws_region) > 0
error_message = "The aws_region var is not set."
}
}
data "amazon-ami" "macos12" {
most_recent = true
owners = [
"amazon",
]
filters = {
architecture = "x86_64_mac"
name = "amzn-ec2-macos-12.*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
}
source "amazon-ebssurrogate" "macami" {
availability_zone = "${var.aws_region}a"
ami_architecture = "x86_64_mac"
ami_name = data.amazon-ami.macos12.name
ami_virtualization_type = "hvm"
decode_authorization_messages = true
ebs_optimized = true
ena_support = true
force_delete_snapshot = true
force_deregister = true
iam_instance_profile = "AmazonSSMRoleForInstancesQuickSetup"
instance_type = "t3a.small"
pause_before_ssm = "2m"
region = var.aws_region
shutdown_behavior = "terminate"
ssh_agent_auth = true
ssh_interface = "session_manager"
ssh_username = "ec2-user"
aws_polling {
max_attempts = 240
delay_seconds = 60
}
vpc_filter {
filters = {
is-default = false
}
}
subnet_filter {
most_free = true
random = true
filters = {
availability-zone = "${var.aws_region}a"
}
}
security_group_filter {
filters = {
group-name = "SSH"
}
}
source_ami_filter {
most_recent = true
owners = [
"amazon",
]
filters = {
architecture = "x86_64"
name = "amzn2-ami-hvm-2.*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
}
launch_block_device_mappings {
delete_on_termination = true
device_name = "/dev/xvdf"
snapshot_id = data.amazon-ami.macos12.block_device_mappings[0].snapshot_id
volume_size = data.amazon-ami.macos12.block_device_mappings[0].volume_size
volume_type = data.amazon-ami.macos12.block_device_mappings[0].volume_type
}
ami_root_device {
delete_on_termination = true
source_device_name = "/dev/xvdf"
device_name = data.amazon-ami.macos12.block_device_mappings[0].device_name
volume_size = data.amazon-ami.macos12.block_device_mappings[0].volume_size
volume_type = data.amazon-ami.macos12.block_device_mappings[0].volume_type
}
}
build {
sources = [
"sources.amazon-ebssurrogate.macami",
]
provisioner "shell" {
scripts = [
"./scripts/apfs.sh",
"./scripts/eic.sh",
"./scripts/jailbreak.sh",
]
}
}