Skip to content

Commit

Permalink
fix(examples): Update AMI filter (philips-labs#1673)
Browse files Browse the repository at this point in the history
- Updated AMI filter to select the latest instead of the latest in 2012
- Add commented examples for AMI and ephemeral to ubuntu example
  • Loading branch information
npalm authored Jan 28, 2022
1 parent 997b171 commit 39c019c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/ephemeral/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module "runners" {

# configure your pre-built AMI
# enabled_userdata = false
# ami_filter = { name = ["github-runner-amzn2-x86_64-2021*"] }
# ami_filter = { name = ["github-runner-amzn2-x86_64-*"] }
# ami_owners = [data.aws_caller_identity.current.account_id]

# Enable logging
Expand Down
4 changes: 2 additions & 2 deletions examples/prebuilt/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ variable "runner_os" {

variable "ami_name_filter" {
type = string
default = "github-runner-amzn2-x86_64-2021*"
default = "github-runner-amzn2-x86_64-*"
}

variable "aws_region" {
type = string
default = "eu-west-1"
}
}
20 changes: 19 additions & 1 deletion examples/ubuntu/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ resource "random_id" "random" {
byte_length = 20
}

data "aws_caller_identity" "current" {}

module "runners" {
source = "../../"

Expand Down Expand Up @@ -35,14 +37,25 @@ module "runners" {
# enable access to the runners via SSM
enable_ssm_on_runners = true

runner_run_as = "ubuntu"
runner_run_as = "ubuntu"

# AMI selection and userdata
#
# option 1. configure your pre-built AMI + userdata
userdata_template = "./templates/user-data.sh"
ami_owners = ["099720109477"] # Canonical's Amazon account ID

ami_filter = {
name = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}

# Custom build AMI, no custom userdata needed.
# option 2: Build custom AMI see ../../images/ubuntu-focal
# disable lines above (option 1) and enable the ones below
# ami_filter = { name = ["github-runner-ubuntu-focal-amd64-*"] }
# ami_owners = [data.aws_caller_identity.current.account_id]


block_device_mappings = {
# Set the block device name for Ubuntu root device
device_name = "/dev/sda1"
Expand All @@ -69,6 +82,11 @@ module "runners" {
}
]

# Uncomment to enable ephemeral runners
# delay_webhook_event = 0
# enable_ephemeral_runners = true
# enabled_userdata = false

# Uncommet idle config to have idle runners from 9 to 5 in time zone Amsterdam
# idle_config = [{
# cron = "* * 9-17 * * *"
Expand Down

0 comments on commit 39c019c

Please sign in to comment.