Skip to content

Commit e21a0ad

Browse files
committed
Additional HCL
1 parent 1ccc57f commit e21a0ad

File tree

6 files changed

+105
-3
lines changed

6 files changed

+105
-3
lines changed

images/linux-al2023/github_agent.linux.pkr.hcl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ variable "instance_type" {
4242
default = "m3.medium"
4343
}
4444

45+
variable "iam_instance_profile" {
46+
description = "IAM instance profile Packer will use for the builder. An empty string (default) means no profile will be assigned."
47+
type = string
48+
default = ""
49+
}
50+
4551
variable "root_volume_size_gb" {
4652
type = number
4753
default = 8
@@ -77,6 +83,12 @@ variable "custom_shell_commands" {
7783
default = []
7884
}
7985

86+
variable "custom_shell_commands_post_runner_install" {
87+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages. This runs after the agent is installed."
88+
type = list(string)
89+
default = []
90+
}
91+
8092
variable "temporary_security_group_source_public_ip" {
8193
description = "When enabled, use public IP of the host (obtained from https://checkip.amazonaws.com) as CIDR block to be authorized access to the instance, when packer is creating a temporary security group. Note: If you specify `security_group_id` then this input is ignored."
8294
type = bool
@@ -98,6 +110,7 @@ locals {
98110
source "amazon-ebs" "githubrunner" {
99111
ami_name = "github-runner-al2023-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100112
instance_type = var.instance_type
113+
iam_instance_profile = var.iam_instance_profile
101114
region = var.region
102115
security_group_id = var.security_group_id
103116
subnet_id = var.subnet_id
@@ -190,6 +203,11 @@ build {
190203
]
191204
}
192205

206+
provisioner "shell" {
207+
environment_vars = []
208+
inline = concat(var.custom_shell_commands_post_runner_install)
209+
}
210+
193211
post-processor "manifest" {
194212
output = "manifest.json"
195213
strip_path = true

images/ubuntu-focal/github_agent.ubuntu.pkr.hcl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ variable "instance_type" {
4242
default = "t3.medium"
4343
}
4444

45+
variable "iam_instance_profile" {
46+
description = "IAM instance profile Packer will use for the builder. An empty string (default) means no profile will be assigned."
47+
type = string
48+
default = ""
49+
}
50+
4551
variable "root_volume_size_gb" {
4652
type = number
4753
default = 8
@@ -77,6 +83,12 @@ variable "custom_shell_commands" {
7783
default = []
7884
}
7985

86+
variable "custom_shell_commands_post_runner_install" {
87+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages. This runs after the agent is installed."
88+
type = list(string)
89+
default = []
90+
}
91+
8092
variable "temporary_security_group_source_public_ip" {
8193
description = "When enabled, use public IP of the host (obtained from https://checkip.amazonaws.com) as CIDR block to be authorized access to the instance, when packer is creating a temporary security group. Note: If you specify `security_group_id` then this input is ignored."
8294
type = bool
@@ -98,6 +110,7 @@ locals {
98110
source "amazon-ebs" "githubrunner" {
99111
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100112
instance_type = var.instance_type
113+
iam_instance_profile = var.iam_instance_profile
101114
region = var.region
102115
security_group_id = var.security_group_id
103116
subnet_id = var.subnet_id
@@ -200,6 +213,12 @@ build {
200213
"sudo chmod +x /var/lib/cloud/scripts/per-boot/start-runner.sh",
201214
]
202215
}
216+
217+
provisioner "shell" {
218+
environment_vars = []
219+
inline = concat(var.custom_shell_commands_post_runner_install)
220+
}
221+
203222
post-processor "manifest" {
204223
output = "manifest.json"
205224
strip_path = true

images/ubuntu-jammy-arm64/github_agent.ubuntu.pkr.hcl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ variable "instance_type" {
4242
default = "t4g.small"
4343
}
4444

45+
variable "iam_instance_profile" {
46+
description = "IAM instance profile Packer will use for the builder. An empty string (default) means no profile will be assigned."
47+
type = string
48+
default = ""
49+
}
50+
4551
variable "root_volume_size_gb" {
4652
type = number
4753
default = 8
@@ -77,6 +83,12 @@ variable "custom_shell_commands" {
7783
default = []
7884
}
7985

86+
variable "custom_shell_commands_post_runner_install" {
87+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages. This runs after the agent is installed."
88+
type = list(string)
89+
default = []
90+
}
91+
8092
variable "temporary_security_group_source_public_ip" {
8193
description = "When enabled, use public IP of the host (obtained from https://checkip.amazonaws.com) as CIDR block to be authorized access to the instance, when packer is creating a temporary security group. Note: If you specify `security_group_id` then this input is ignored."
8294
type = bool
@@ -98,6 +110,7 @@ locals {
98110
source "amazon-ebs" "githubrunner" {
99111
ami_name = "github-runner-ubuntu-jammy-arm64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100112
instance_type = var.instance_type
113+
iam_instance_profile = var.iam_instance_profile
101114
region = var.region
102115
security_group_id = var.security_group_id
103116
subnet_id = var.subnet_id

images/ubuntu-jammy/github_agent.ubuntu.pkr.hcl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ variable "instance_type" {
4242
default = "t3.medium"
4343
}
4444

45+
variable "iam_instance_profile" {
46+
description = "IAM instance profile Packer will use for the builder. An empty string (default) means no profile will be assigned."
47+
type = string
48+
default = ""
49+
}
50+
4551
variable "root_volume_size_gb" {
4652
type = number
4753
default = 8
@@ -77,6 +83,12 @@ variable "custom_shell_commands" {
7783
default = []
7884
}
7985

86+
variable "custom_shell_commands_post_runner_install" {
87+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages. This runs after the agent is installed."
88+
type = list(string)
89+
default = []
90+
}
91+
8092
variable "temporary_security_group_source_public_ip" {
8193
description = "When enabled, use public IP of the host (obtained from https://checkip.amazonaws.com) as CIDR block to be authorized access to the instance, when packer is creating a temporary security group. Note: If you specify `security_group_id` then this input is ignored."
8294
type = bool
@@ -98,6 +110,7 @@ locals {
98110
source "amazon-ebs" "githubrunner" {
99111
ami_name = "github-runner-ubuntu-jammy-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100112
instance_type = var.instance_type
113+
iam_instance_profile = var.iam_instance_profile
101114
region = var.region
102115
security_group_id = var.security_group_id
103116
subnet_id = var.subnet_id
@@ -200,6 +213,12 @@ build {
200213
"sudo chmod +x /var/lib/cloud/scripts/per-boot/start-runner.sh",
201214
]
202215
}
216+
217+
provisioner "shell" {
218+
environment_vars = []
219+
inline = concat(var.custom_shell_commands_post_runner_install)
220+
}
221+
203222
post-processor "manifest" {
204223
output = "manifest.json"
205224
strip_path = true

images/windows-core-2019/github_agent.windows.pkr.hcl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ variable "instance_type" {
2424
default = "t3a.medium"
2525
}
2626

27+
variable "iam_instance_profile" {
28+
description = "IAM instance profile Packer will use for the builder. An empty string (default) means no profile will be assigned."
29+
type = string
30+
default = ""
31+
}
32+
2733
variable "ebs_delete_on_termination" {
2834
description = "Indicates whether the EBS volume is deleted on instance termination."
2935
type = bool
@@ -42,6 +48,12 @@ variable "custom_shell_commands" {
4248
default = []
4349
}
4450

51+
variable "custom_shell_commands_post_runner_install" {
52+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages. This runs after the agent is installed."
53+
type = list(string)
54+
default = []
55+
}
56+
4557
variable "temporary_security_group_source_public_ip" {
4658
description = "When enabled, use public IP of the host (obtained from https://checkip.amazonaws.com) as CIDR block to be authorized access to the instance, when packer is creating a temporary security group. Note: If you specify `security_group_id` then this input is ignored."
4759
type = bool
@@ -64,6 +76,7 @@ source "amazon-ebs" "githubrunner" {
6476
ami_name = "github-runner-windows-core-2019-${formatdate("YYYYMMDDhhmm", timestamp())}"
6577
communicator = "winrm"
6678
instance_type = var.instance_type
79+
iam_instance_profile = var.iam_instance_profile
6780
region = var.region
6881
associate_public_ip_address = var.associate_public_ip_address
6982
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
@@ -112,8 +125,9 @@ build {
112125
templatefile("./windows-provisioner.ps1", {
113126
action_runner_url = "https://github.com/actions/runner/releases/download/v${local.runner_version}/actions-runner-win-x64-${local.runner_version}.zip"
114127
})
115-
], var.custom_shell_commands)
128+
], var.custom_shell_commands, var.custom_shell_commands_post_runner_install)
116129
}
130+
117131
post-processor "manifest" {
118132
output = "manifest.json"
119133
strip_path = true

images/windows-core-2022/github_agent.windows.pkr.hcl

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ variable "region" {
1818
default = "eu-west-1"
1919
}
2020

21+
variable "instance_type" {
22+
description = "The instance type Packer will use for the builder"
23+
type = string
24+
default = "m4.xlarge"
25+
}
26+
27+
variable "iam_instance_profile" {
28+
description = "IAM instance profile Packer will use for the builder. An empty string (default) means no profile will be assigned."
29+
type = string
30+
default = ""
31+
}
32+
2133
variable "security_group_id" {
2234
description = "The ID of the security group Packer will associate with the builder to enable access"
2335
type = string
@@ -53,6 +65,12 @@ variable "custom_shell_commands" {
5365
default = []
5466
}
5567

68+
variable "custom_shell_commands_post_runner_install" {
69+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages. This runs after the agent is installed."
70+
type = list(string)
71+
default = []
72+
}
73+
5674
variable "temporary_security_group_source_public_ip" {
5775
description = "When enabled, use public IP of the host (obtained from https://checkip.amazonaws.com) as CIDR block to be authorized access to the instance, when packer is creating a temporary security group. Note: If you specify `security_group_id` then this input is ignored."
5876
type = bool
@@ -74,7 +92,8 @@ locals {
7492
source "amazon-ebs" "githubrunner" {
7593
ami_name = "github-runner-windows-core-2022-${formatdate("YYYYMMDDhhmm", timestamp())}"
7694
communicator = "winrm"
77-
instance_type = "m4.xlarge"
95+
instance_type = var.instance_type
96+
iam_instance_profile = var.iam_instance_profile
7897
region = var.region
7998
security_group_id = var.security_group_id
8099
subnet_id = var.subnet_id
@@ -126,7 +145,7 @@ build {
126145
templatefile("./windows-provisioner.ps1", {
127146
action_runner_url = "https://github.com/actions/runner/releases/download/v${local.runner_version}/actions-runner-win-x64-${local.runner_version}.zip"
128147
})
129-
], var.custom_shell_commands)
148+
], var.custom_shell_commands, var.custom_shell_commands_post_runner_install)
130149
}
131150
post-processor "manifest" {
132151
output = "manifest.json"

0 commit comments

Comments
 (0)