Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 6d018f6

Browse files
authored
feat(images): Allow specifying temporary security group source IP for packer builds (#3351)
* feat(images): Allow specifying temporary security group source IP for packer builds * feat(images): Update temporary_security_group_source_public_ip description
1 parent 7a3d825 commit 6d018f6

File tree

6 files changed

+79
-36
lines changed

6 files changed

+79
-36
lines changed

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

+14-6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ variable "custom_shell_commands" {
7777
default = []
7878
}
7979

80+
variable "temporary_security_group_source_public_ip" {
81+
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."
82+
type = bool
83+
default = false
84+
}
85+
8086
data "http" github_runner_release_json {
8187
url = "https://api.github.com/repos/actions/runner/releases/latest"
8288
request_headers = {
@@ -90,12 +96,14 @@ locals {
9096
}
9197

9298
source "amazon-ebs" "githubrunner" {
93-
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
94-
instance_type = var.instance_type
95-
region = var.region
96-
security_group_id = var.security_group_id
97-
subnet_id = var.subnet_id
98-
associate_public_ip_address = var.associate_public_ip_address
99+
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100+
instance_type = var.instance_type
101+
region = var.region
102+
security_group_id = var.security_group_id
103+
subnet_id = var.subnet_id
104+
associate_public_ip_address = var.associate_public_ip_address
105+
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
106+
99107
source_ami_filter {
100108
filters = {
101109
name = "amzn2-ami-kernel-5.*-hvm-*-x86_64-gp2"

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

+13-6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ variable "custom_shell_commands" {
7777
default = []
7878
}
7979

80+
variable "temporary_security_group_source_public_ip" {
81+
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."
82+
type = bool
83+
default = false
84+
}
85+
8086
data "http" github_runner_release_json {
8187
url = "https://api.github.com/repos/actions/runner/releases/latest"
8288
request_headers = {
@@ -90,12 +96,13 @@ locals {
9096
}
9197

9298
source "amazon-ebs" "githubrunner" {
93-
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
94-
instance_type = var.instance_type
95-
region = var.region
96-
security_group_id = var.security_group_id
97-
subnet_id = var.subnet_id
98-
associate_public_ip_address = var.associate_public_ip_address
99+
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100+
instance_type = var.instance_type
101+
region = var.region
102+
security_group_id = var.security_group_id
103+
subnet_id = var.subnet_id
104+
associate_public_ip_address = var.associate_public_ip_address
105+
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
99106

100107
source_ami_filter {
101108
filters = {

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

+13-6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ variable "custom_shell_commands" {
7777
default = []
7878
}
7979

80+
variable "temporary_security_group_source_public_ip" {
81+
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."
82+
type = bool
83+
default = false
84+
}
85+
8086
data "http" github_runner_release_json {
8187
url = "https://api.github.com/repos/actions/runner/releases/latest"
8288
request_headers = {
@@ -90,12 +96,13 @@ locals {
9096
}
9197

9298
source "amazon-ebs" "githubrunner" {
93-
ami_name = "github-runner-ubuntu-jammy-arm64-${formatdate("YYYYMMDDhhmm", timestamp())}"
94-
instance_type = var.instance_type
95-
region = var.region
96-
security_group_id = var.security_group_id
97-
subnet_id = var.subnet_id
98-
associate_public_ip_address = var.associate_public_ip_address
99+
ami_name = "github-runner-ubuntu-jammy-arm64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100+
instance_type = var.instance_type
101+
region = var.region
102+
security_group_id = var.security_group_id
103+
subnet_id = var.subnet_id
104+
associate_public_ip_address = var.associate_public_ip_address
105+
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
99106

100107
source_ami_filter {
101108
filters = {

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

+13-6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ variable "custom_shell_commands" {
7777
default = []
7878
}
7979

80+
variable "temporary_security_group_source_public_ip" {
81+
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."
82+
type = bool
83+
default = false
84+
}
85+
8086
data "http" github_runner_release_json {
8187
url = "https://api.github.com/repos/actions/runner/releases/latest"
8288
request_headers = {
@@ -90,12 +96,13 @@ locals {
9096
}
9197

9298
source "amazon-ebs" "githubrunner" {
93-
ami_name = "github-runner-ubuntu-jammy-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
94-
instance_type = var.instance_type
95-
region = var.region
96-
security_group_id = var.security_group_id
97-
subnet_id = var.subnet_id
98-
associate_public_ip_address = var.associate_public_ip_address
99+
ami_name = "github-runner-ubuntu-jammy-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100+
instance_type = var.instance_type
101+
region = var.region
102+
security_group_id = var.security_group_id
103+
subnet_id = var.subnet_id
104+
associate_public_ip_address = var.associate_public_ip_address
105+
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
99106

100107
source_ami_filter {
101108
filters = {

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

+12-5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ variable "custom_shell_commands" {
4242
default = []
4343
}
4444

45+
variable "temporary_security_group_source_public_ip" {
46+
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."
47+
type = bool
48+
default = false
49+
}
50+
4551
data "http" github_runner_release_json {
4652
url = "https://api.github.com/repos/actions/runner/releases/latest"
4753
request_headers = {
@@ -55,11 +61,12 @@ locals {
5561
}
5662

5763
source "amazon-ebs" "githubrunner" {
58-
ami_name = "github-runner-windows-core-2019-${formatdate("YYYYMMDDhhmm", timestamp())}"
59-
communicator = "winrm"
60-
instance_type = var.instance_type
61-
region = var.region
62-
associate_public_ip_address = var.associate_public_ip_address
64+
ami_name = "github-runner-windows-core-2019-${formatdate("YYYYMMDDhhmm", timestamp())}"
65+
communicator = "winrm"
66+
instance_type = var.instance_type
67+
region = var.region
68+
associate_public_ip_address = var.associate_public_ip_address
69+
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
6370

6471
source_ami_filter {
6572
filters = {

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

+14-7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ variable "custom_shell_commands" {
5353
default = []
5454
}
5555

56+
variable "temporary_security_group_source_public_ip" {
57+
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."
58+
type = bool
59+
default = false
60+
}
61+
5662
data "http" github_runner_release_json {
5763
url = "https://api.github.com/repos/actions/runner/releases/latest"
5864
request_headers = {
@@ -66,13 +72,14 @@ locals {
6672
}
6773

6874
source "amazon-ebs" "githubrunner" {
69-
ami_name = "github-runner-windows-core-2022-${formatdate("YYYYMMDDhhmm", timestamp())}"
70-
communicator = "winrm"
71-
instance_type = "m4.xlarge"
72-
region = var.region
73-
security_group_id = var.security_group_id
74-
subnet_id = var.subnet_id
75-
associate_public_ip_address = var.associate_public_ip_address
75+
ami_name = "github-runner-windows-core-2022-${formatdate("YYYYMMDDhhmm", timestamp())}"
76+
communicator = "winrm"
77+
instance_type = "m4.xlarge"
78+
region = var.region
79+
security_group_id = var.security_group_id
80+
subnet_id = var.subnet_id
81+
associate_public_ip_address = var.associate_public_ip_address
82+
temporary_security_group_source_public_ip = var.temporary_security_group_source_public_ip
7683

7784
source_ami_filter {
7885
filters = {

0 commit comments

Comments
 (0)