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

Commit 052e9f8

Browse files
authored
feat: Add associate_public_ip_address variable (#1816)
1 parent c2a834f commit 052e9f8

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

Diff for: images/linux-amzn2/github_agent.linux.pkr.hcl

+12-5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ variable "subnet_id" {
3131
default = null
3232
}
3333

34+
variable "associate_public_ip_address" {
35+
description = "If using a non-default VPC, there is no public IP address assigned to the EC2 instance. If you specified a public subnet, you probably want to set this to true. Otherwise the EC2 instance won't have access to the internet"
36+
type = string
37+
default = null
38+
}
39+
3440
variable "instance_type" {
3541
description = "The instance type Packer will use for the builder"
3642
type = string
@@ -67,11 +73,12 @@ variable "snapshot_tags" {
6773
}
6874

6975
source "amazon-ebs" "githubrunner" {
70-
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
71-
instance_type = var.instance_type
72-
region = var.region
73-
security_group_id = var.security_group_id
74-
subnet_id = var.subnet_id
76+
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
77+
instance_type = var.instance_type
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
7582
source_ami_filter {
7683
filters = {
7784
name = "amzn2-ami-hvm-2.*-x86_64-ebs"

Diff for: images/ubuntu-focal/github_agent.ubuntu.pkr.hcl

+13-5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ variable "subnet_id" {
3131
default = null
3232
}
3333

34+
variable "associate_public_ip_address" {
35+
description = "If using a non-default VPC, there is no public IP address assigned to the EC2 instance. If you specified a public subnet, you probably want to set this to true. Otherwise the EC2 instance won't have access to the internet"
36+
type = string
37+
default = null
38+
}
39+
3440
variable "instance_type" {
3541
description = "The instance type Packer will use for the builder"
3642
type = string
@@ -67,11 +73,13 @@ variable "snapshot_tags" {
6773
}
6874

6975
source "amazon-ebs" "githubrunner" {
70-
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
71-
instance_type = var.instance_type
72-
region = var.region
73-
security_group_id = var.security_group_id
74-
subnet_id = var.subnet_id
76+
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
77+
instance_type = var.instance_type
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+
7583
source_ami_filter {
7684
filters = {
7785
name = "*/ubuntu-focal-20.04-amd64-server-*"

0 commit comments

Comments
 (0)