main.tf 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. locals {
  2. environment = "ubuntu"
  3. aws_region = "eu-west-1"
  4. }
  5. resource "random_id" "random" {
  6. byte_length = 20
  7. }
  8. data "aws_caller_identity" "current" {}
  9. module "runners" {
  10. source = "../../"
  11. aws_region = local.aws_region
  12. vpc_id = module.vpc.vpc_id
  13. subnet_ids = module.vpc.private_subnets
  14. prefix = local.environment
  15. tags = {
  16. Project = "ProjectX"
  17. }
  18. github_app = {
  19. key_base64 = var.github_app_key_base64
  20. id = var.github_app_id
  21. webhook_secret = random_id.random.hex
  22. }
  23. # webhook_lambda_zip = "lambdas-download/webhook.zip"
  24. # runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
  25. # runners_lambda_zip = "lambdas-download/runners.zip"
  26. enable_organization_runners = false
  27. runner_extra_labels = "ubuntu,example"
  28. # enable access to the runners via SSM
  29. enable_ssm_on_runners = true
  30. runner_run_as = "ubuntu"
  31. # AMI selection and userdata
  32. #
  33. # option 1. configure your pre-built AMI + userdata
  34. userdata_template = "./templates/user-data.sh"
  35. ami_owners = ["099720109477"] # Canonical's Amazon account ID
  36. ami_filter = {
  37. name = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
  38. }
  39. # Custom build AMI, no custom userdata needed.
  40. # option 2: Build custom AMI see ../../images/ubuntu-focal
  41. # disable lines above (option 1) and enable the ones below
  42. # ami_filter = { name = ["github-runner-ubuntu-focal-amd64-*"] }
  43. # ami_owners = [data.aws_caller_identity.current.account_id]
  44. block_device_mappings = [{
  45. # Set the block device name for Ubuntu root device
  46. device_name = "/dev/sda1"
  47. delete_on_termination = true
  48. volume_type = "gp3"
  49. volume_size = 30
  50. encrypted = true
  51. iops = null
  52. }]
  53. runner_log_files = [
  54. {
  55. "log_group_name" : "syslog",
  56. "prefix_log_group" : true,
  57. "file_path" : "/var/log/syslog",
  58. "log_stream_name" : "{instance_id}"
  59. },
  60. {
  61. "log_group_name" : "user_data",
  62. "prefix_log_group" : true,
  63. "file_path" : "/var/log/user-data.log",
  64. "log_stream_name" : "{instance_id}/user_data"
  65. },
  66. {
  67. "log_group_name" : "runner",
  68. "prefix_log_group" : true,
  69. "file_path" : "/opt/actions-runner/_diag/Runner_**.log",
  70. "log_stream_name" : "{instance_id}/runner"
  71. }
  72. ]
  73. # Uncomment to enable ephemeral runners
  74. # delay_webhook_event = 0
  75. # enable_ephemeral_runners = true
  76. # enabled_userdata = false
  77. # Uncommet idle config to have idle runners from 9 to 5 in time zone Amsterdam
  78. # idle_config = [{
  79. # cron = "* * 9-17 * * *"
  80. # timeZone = "Europe/Amsterdam"
  81. # idleCount = 1
  82. # }]
  83. }