variables.tf 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. variable "aws_region" {
  2. description = "AWS region."
  3. type = string
  4. }
  5. variable "tags" {
  6. description = "Map of tags that will be added to created resources. By default resources will be tagged with name and environment."
  7. type = map(string)
  8. default = {}
  9. }
  10. variable "environment" {
  11. description = "A name that identifies the environment, used as prefix and for tagging."
  12. type = string
  13. default = null
  14. validation {
  15. condition = var.environment == null
  16. error_message = "The \"environment\" variable is no longer used. To migrate, set the \"prefix\" variable to the original value of \"environment\" and optionally, add \"Environment\" to the \"tags\" variable map with the same value."
  17. }
  18. }
  19. variable "prefix" {
  20. description = "The prefix used for naming resources"
  21. type = string
  22. default = "github-actions"
  23. }
  24. variable "distribution_bucket_name" {
  25. description = "Bucket for storing the action runner distribution."
  26. type = string
  27. # Make sure the bucket name only contains legal characters
  28. validation {
  29. error_message = "Only lowercase alphanumeric characters and hyphens allowed in the bucket name."
  30. condition = can(regex("^[a-z0-9-]*$", var.distribution_bucket_name))
  31. }
  32. }
  33. variable "lambda_schedule_expression" {
  34. description = "Scheduler expression for action runner binary syncer."
  35. type = string
  36. default = "cron(27 * * * ? *)"
  37. }
  38. variable "lambda_zip" {
  39. description = "File location of the lambda zip file."
  40. type = string
  41. default = null
  42. }
  43. variable "lambda_timeout" {
  44. description = "Time out of the lambda in seconds."
  45. type = number
  46. default = 300
  47. }
  48. variable "role_permissions_boundary" {
  49. description = "Permissions boundary that will be added to the created role for the lambda."
  50. type = string
  51. default = null
  52. }
  53. variable "role_path" {
  54. description = "The path that will be added to the role, if not set the environment name will be used."
  55. type = string
  56. default = null
  57. }
  58. variable "runner_os" {
  59. description = "The EC2 Operating System type to use for action runner instances (linux,windows)."
  60. type = string
  61. default = "linux"
  62. validation {
  63. condition = contains(["linux", "windows"], var.runner_os)
  64. error_message = "Valid values for runner_os are (linux, windows)."
  65. }
  66. }
  67. variable "runner_architecture" {
  68. description = "The platform architecture of the runner instance_type."
  69. type = string
  70. default = "x64"
  71. validation {
  72. condition = anytrue([
  73. var.runner_architecture == "x64",
  74. var.runner_architecture == "arm64",
  75. ])
  76. error_message = "`runner_architecture` value not valid, valid values are: `x64` and `arm64`."
  77. }
  78. }
  79. variable "logging_retention_in_days" {
  80. description = "Specifies the number of days you want to retain log events for the lambda log group. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653."
  81. type = number
  82. default = 7
  83. }
  84. variable "logging_kms_key_id" {
  85. description = "Specifies the kms key id to encrypt the logs with"
  86. type = string
  87. default = null
  88. }
  89. variable "runner_allow_prerelease_binaries" {
  90. description = "Allow the runners to update to prerelease binaries."
  91. type = bool
  92. default = false
  93. }
  94. variable "lambda_s3_bucket" {
  95. description = "S3 bucket from which to specify lambda functions. This is an alternative to providing local files directly."
  96. default = null
  97. }
  98. variable "syncer_lambda_s3_key" {
  99. description = "S3 key for syncer lambda function. Required if using S3 bucket to specify lambdas."
  100. default = null
  101. }
  102. variable "syncer_lambda_s3_object_version" {
  103. description = "S3 object version for syncer lambda function. Useful if S3 versioning is enabled on source bucket."
  104. default = null
  105. }
  106. variable "lambda_subnet_ids" {
  107. description = "List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`."
  108. type = list(string)
  109. default = []
  110. }
  111. variable "lambda_security_group_ids" {
  112. description = "List of security group IDs associated with the Lambda function."
  113. type = list(string)
  114. default = []
  115. }
  116. variable "log_type" {
  117. description = "Logging format for lambda logging. Valid values are 'json', 'pretty', 'hidden'. "
  118. type = string
  119. default = "pretty"
  120. validation {
  121. condition = anytrue([
  122. var.log_type == "json",
  123. var.log_type == "pretty",
  124. var.log_type == "hidden",
  125. ])
  126. error_message = "`log_type` value not valid. Valid values are 'json', 'pretty', 'hidden'."
  127. }
  128. }
  129. variable "log_level" {
  130. description = "Logging level for lambda logging. Valid values are 'silly', 'trace', 'debug', 'info', 'warn', 'error', 'fatal'."
  131. type = string
  132. default = "info"
  133. validation {
  134. condition = anytrue([
  135. var.log_level == "silly",
  136. var.log_level == "trace",
  137. var.log_level == "debug",
  138. var.log_level == "info",
  139. var.log_level == "warn",
  140. var.log_level == "error",
  141. var.log_level == "fatal",
  142. ])
  143. error_message = "`log_level` value not valid. Valid values are 'silly', 'trace', 'debug', 'info', 'warn', 'error', 'fatal'."
  144. }
  145. }
  146. variable "server_side_encryption_configuration" {
  147. description = "Map containing server-side encryption configuration."
  148. type = any
  149. default = {}
  150. }
  151. variable "lambda_principals" {
  152. description = "(Optional) add extra principals to the role created for execution of the lambda, e.g. for local testing."
  153. type = list(object({
  154. type = string
  155. identifiers = list(string)
  156. }))
  157. default = []
  158. }
  159. variable "lambda_runtime" {
  160. description = "AWS Lambda runtime."
  161. type = string
  162. default = "nodejs16.x"
  163. }
  164. variable "lambda_architecture" {
  165. description = "AWS Lambda architecture. Lambda functions using Graviton processors ('arm64') tend to have better price/performance than 'x86_64' functions. "
  166. type = string
  167. default = "x86_64"
  168. validation {
  169. condition = contains(["arm64", "x86_64"], var.lambda_architecture)
  170. error_message = "`lambda_architecture` value is not valid, valid values are: `arm64` and `x86_64`."
  171. }
  172. }