main.tf 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. locals {
  2. environment = "default"
  3. aws_region = "eu-west-1"
  4. }
  5. resource "random_id" "random" {
  6. byte_length = 20
  7. }
  8. ################################################################################
  9. ### Hybrid account
  10. ################################################################################
  11. module "runners" {
  12. source = "../../"
  13. create_service_linked_role_spot = true
  14. aws_region = local.aws_region
  15. vpc_id = module.vpc.vpc_id
  16. subnet_ids = module.vpc.private_subnets
  17. prefix = local.environment
  18. tags = {
  19. Project = "ProjectX"
  20. }
  21. github_app = {
  22. key_base64 = var.github_app_key_base64
  23. id = var.github_app_id
  24. webhook_secret = random_id.random.hex
  25. }
  26. # Grab zip files via lambda_download, will automatically get the ARM64 build
  27. webhook_lambda_zip = "lambdas-download/webhook.zip"
  28. runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
  29. runners_lambda_zip = "lambdas-download/runners.zip"
  30. enable_organization_runners = false
  31. # Runners will automatically get the "arm64" label
  32. runner_extra_labels = "default,example"
  33. # enable access to the runners via SSM
  34. enable_ssm_on_runners = true
  35. # use S3 or KMS SSE to runners S3 bucket
  36. # runner_binaries_s3_sse_configuration = {
  37. # rule = {
  38. # apply_server_side_encryption_by_default = {
  39. # sse_algorithm = "AES256"
  40. # }
  41. # }
  42. # }
  43. # Uncommet idle config to have idle runners from 9 to 5 in time zone Amsterdam
  44. # idle_config = [{
  45. # cron = "* * 9-17 * * *"
  46. # timeZone = "Europe/Amsterdam"
  47. # idleCount = 1
  48. # }]
  49. # Let the module manage the service linked role
  50. # create_service_linked_role_spot = true
  51. runner_architecture = "arm64"
  52. # Ensure all instance types have ARM64 architecture (ie. AWS Graviton processors)
  53. instance_types = ["t4g.large", "c6g.large"]
  54. # override delay of events in seconds
  55. delay_webhook_event = 5
  56. runners_maximum_count = 1
  57. # set up a fifo queue to remain order
  58. fifo_build_queue = true
  59. # override scaling down
  60. scale_down_schedule_expression = "cron(* * * * ? *)"
  61. }