Skip to content

Commit

Permalink
feat: Add associate_public_ip_address variable (philips-labs#1816)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulich authored Mar 7, 2022
1 parent c2a834f commit 052e9f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
17 changes: 12 additions & 5 deletions images/linux-amzn2/github_agent.linux.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ variable "subnet_id" {
default = null
}

variable "associate_public_ip_address" {
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"
type = string
default = null
}

variable "instance_type" {
description = "The instance type Packer will use for the builder"
type = string
Expand Down Expand Up @@ -67,11 +73,12 @@ variable "snapshot_tags" {
}

source "amazon-ebs" "githubrunner" {
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
instance_type = var.instance_type
region = var.region
security_group_id = var.security_group_id
subnet_id = var.subnet_id
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
instance_type = var.instance_type
region = var.region
security_group_id = var.security_group_id
subnet_id = var.subnet_id
associate_public_ip_address = var.associate_public_ip_address
source_ami_filter {
filters = {
name = "amzn2-ami-hvm-2.*-x86_64-ebs"
Expand Down
18 changes: 13 additions & 5 deletions images/ubuntu-focal/github_agent.ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ variable "subnet_id" {
default = null
}

variable "associate_public_ip_address" {
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"
type = string
default = null
}

variable "instance_type" {
description = "The instance type Packer will use for the builder"
type = string
Expand Down Expand Up @@ -67,11 +73,13 @@ variable "snapshot_tags" {
}

source "amazon-ebs" "githubrunner" {
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
instance_type = var.instance_type
region = var.region
security_group_id = var.security_group_id
subnet_id = var.subnet_id
ami_name = "github-runner-ubuntu-focal-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
instance_type = var.instance_type
region = var.region
security_group_id = var.security_group_id
subnet_id = var.subnet_id
associate_public_ip_address = var.associate_public_ip_address

source_ami_filter {
filters = {
name = "*/ubuntu-focal-20.04-amd64-server-*"
Expand Down

0 comments on commit 052e9f8

Please sign in to comment.