main.tf 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. locals {
  2. environment = "ephemeral"
  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. create_service_linked_role_spot = true
  12. aws_region = local.aws_region
  13. vpc_id = module.vpc.vpc_id
  14. subnet_ids = module.vpc.private_subnets
  15. prefix = local.environment
  16. tags = {
  17. Project = "ProjectX"
  18. }
  19. github_app = {
  20. key_base64 = var.github_app_key_base64
  21. id = var.github_app_id
  22. webhook_secret = random_id.random.hex
  23. }
  24. # Grab the lambda packages from local directory. Must run /.ci/build.sh first
  25. webhook_lambda_zip = "../../lambda_output/webhook.zip"
  26. runner_binaries_syncer_lambda_zip = "../../lambda_output/runner-binaries-syncer.zip"
  27. runners_lambda_zip = "../../lambda_output/runners.zip"
  28. enable_organization_runners = true
  29. runner_extra_labels = "default,example"
  30. # enable workflow labels check
  31. # runner_enable_workflow_job_labels_check = true
  32. # enable access to the runners via SSM
  33. enable_ssm_on_runners = true
  34. # Let the module manage the service linked role
  35. # create_service_linked_role_spot = true
  36. instance_types = ["m5.large", "c5.large"]
  37. # override delay of events in seconds
  38. delay_webhook_event = 0
  39. # Ensure you set the number not too low, each build require a new instance
  40. runners_maximum_count = 20
  41. # override scaling down
  42. scale_down_schedule_expression = "cron(* * * * ? *)"
  43. enable_ephemeral_runners = true
  44. # # Example of simple pool usages
  45. # pool_runner_owner = "my-org"
  46. # pool_config = [{
  47. # size = 20
  48. # schedule_expression = "cron(* * * * ? *)"
  49. # }]
  50. #
  51. #
  52. enable_job_queued_check = true
  53. # configure your pre-built AMI
  54. # enabled_userdata = false
  55. # ami_filter = { name = ["github-runner-amzn2-x86_64-*"] }
  56. # ami_owners = [data.aws_caller_identity.current.account_id]
  57. # Enable logging
  58. log_level = "debug"
  59. # Setup a dead letter queue, by default scale up lambda will kepp retrying to process event in case of scaling error.
  60. # redrive_policy_build_queue = {
  61. # enabled = true
  62. # maxReceiveCount = 50 # 50 retries every 30 seconds => 25 minutes
  63. # deadLetterTargetArn = null
  64. # }
  65. }