From 29508c0e69dcd32f8fa9f53926aa92f8c60c2805 Mon Sep 17 00:00:00 2001 From: Niek Palm Date: Fri, 28 Jan 2022 11:33:48 +0100 Subject: [PATCH] fix(examples): Update AMI filter - Updated AMI filter to select the latest instead of the latest in 2012 - Add commented examples for AMI and ephemeral to ubuntu example --- examples/ephemeral/main.tf | 2 +- examples/prebuilt/variables.tf | 4 ++-- examples/ubuntu/main.tf | 20 +++++++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/examples/ephemeral/main.tf b/examples/ephemeral/main.tf index c7b7e5e620..3bf14b00d6 100644 --- a/examples/ephemeral/main.tf +++ b/examples/ephemeral/main.tf @@ -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 diff --git a/examples/prebuilt/variables.tf b/examples/prebuilt/variables.tf index 3e97a3144c..87bd222957 100644 --- a/examples/prebuilt/variables.tf +++ b/examples/prebuilt/variables.tf @@ -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" -} \ No newline at end of file +} diff --git a/examples/ubuntu/main.tf b/examples/ubuntu/main.tf index c5755c2fc6..d053d0d29b 100644 --- a/examples/ubuntu/main.tf +++ b/examples/ubuntu/main.tf @@ -7,6 +7,8 @@ resource "random_id" "random" { byte_length = 20 } +data "aws_caller_identity" "current" {} + module "runners" { source = "../../" @@ -35,7 +37,11 @@ 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 @@ -43,6 +49,13 @@ module "runners" { 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" @@ -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 * * *"