main.tf 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. # configure the block device mappings, default for Amazon Linux2
  27. # block_device_mappings = [{
  28. # device_name = "/dev/xvda"
  29. # delete_on_termination = true
  30. # volume_type = "gp3"
  31. # volume_size = 10
  32. # encrypted = true
  33. # iops = null
  34. # }]
  35. # Grab zip files via lambda_download
  36. webhook_lambda_zip = "lambdas-download/webhook.zip"
  37. runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
  38. runners_lambda_zip = "lambdas-download/runners.zip"
  39. enable_organization_runners = false
  40. runner_extra_labels = "default,example"
  41. # enable access to the runners via SSM
  42. enable_ssm_on_runners = true
  43. # use S3 or KMS SSE to runners S3 bucket
  44. # runner_binaries_s3_sse_configuration = {
  45. # rule = {
  46. # apply_server_side_encryption_by_default = {
  47. # sse_algorithm = "AES256"
  48. # }
  49. # }
  50. # }
  51. # Uncommet idle config to have idle runners from 9 to 5 in time zone Amsterdam
  52. # idle_config = [{
  53. # cron = "* * 9-17 * * *"
  54. # timeZone = "Europe/Amsterdam"
  55. # idleCount = 1
  56. # }]
  57. # Let the module manage the service linked role
  58. # create_service_linked_role_spot = true
  59. instance_types = ["m5.large", "c5.large"]
  60. # override delay of events in seconds
  61. delay_webhook_event = 5
  62. runners_maximum_count = 1
  63. # set up a fifo queue to remain order
  64. fifo_build_queue = true
  65. # override scaling down
  66. scale_down_schedule_expression = "cron(* * * * ? *)"
  67. }