variables.tf 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. variable "name" {
  2. description = "Name of the fastly service (defaults to hostname)."
  3. type = string
  4. default = ""
  5. }
  6. variable "hostname" {
  7. description = "Hostname the service points to."
  8. type = string
  9. }
  10. variable "domains" {
  11. description = "Additional domains to assign to this service"
  12. type = list(string)
  13. default = []
  14. }
  15. variable "ssl_hostname" {
  16. description = "Hostname to use for SSL verification (if different from 'hostname')."
  17. type = string
  18. default = ""
  19. }
  20. variable "default_ttl" {
  21. description = "The default Time-to-live (TTL) for requests"
  22. type = number
  23. default = 0
  24. }
  25. variable "backend_name" {
  26. description = "Optional name for the backend."
  27. type = string
  28. default = ""
  29. }
  30. variable "backend_address" {
  31. description = "Address to use for connecting to the backend. Can be a hostname or an IP address."
  32. type = string
  33. }
  34. variable "backend_port" {
  35. description = "The port number on which the Backend responds."
  36. type = number
  37. default = 443
  38. }
  39. variable "backend_ssl_check" {
  40. description = "Be strict about checking SSL certs when connecting to the backend."
  41. type = bool
  42. default = true
  43. }
  44. variable "backend_ca_cert" {
  45. description = "CA cert to use when connecting to the backend."
  46. type = string
  47. sensitive = true
  48. }
  49. variable "backend_first_byte_timeout" {
  50. description = "How long to wait for the first bytes in milliseconds."
  51. type = number
  52. default = 15000
  53. }
  54. variable "backend_between_bytes_timeout" {
  55. description = "How long to wait between bytes in milliseconds."
  56. type = number
  57. default = 10000
  58. }
  59. variable "max_conn" {
  60. description = "Maximum number of connections for the Backend."
  61. type = number
  62. default = 500
  63. }
  64. variable "min_tls_version" {
  65. description = "Minimum allowed TLS version on SSL connections to the backend."
  66. type = string
  67. default = "1.2"
  68. }
  69. variable "use_ssl" {
  70. description = "Whether or not to use SSL to reach the Backend."
  71. type = bool
  72. default = true
  73. }
  74. variable "shield_region" {
  75. description = "Which Fastly shield region to use. Should correspond with the shield code."
  76. type = string
  77. }
  78. variable "media_backend" {
  79. description = "Additional backend to use for service media files"
  80. type = object({
  81. address = string
  82. name = optional(string, "")
  83. condition = optional(string, "")
  84. condition_name = optional(string, "Media backend condition")
  85. ssl_check = optional(bool, true)
  86. ssl_hostname = optional(string, "")
  87. bucket_prefix = optional(string, "")
  88. })
  89. default = { address = "" }
  90. }
  91. variable "healthcheck_host" {
  92. description = "Host to ping for healthcheck. Defaults to hostname."
  93. type = string
  94. default = ""
  95. }
  96. variable "healthcheck_name" {
  97. description = "Optional name for the healthcheck."
  98. type = string
  99. default = ""
  100. }
  101. variable "healthcheck_path" {
  102. description = "URL to use when doing a healthcheck."
  103. type = string
  104. default = "/health"
  105. }
  106. variable "healthcheck_method" {
  107. description = "HTTP method to use when doing a healthcheck."
  108. type = string
  109. default = "HEAD"
  110. validation {
  111. condition = contains(["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE"], var.healthcheck_method)
  112. error_message = "Healthcheck method must be a valid HTTP method"
  113. }
  114. }
  115. variable "force_tls_hsts" {
  116. description = "Force TLS and HTTP Strict Transport Security (HSTS) to ensure that every request is secure."
  117. type = bool
  118. default = true
  119. }
  120. variable "hsts_duration" {
  121. description = "Number of seconds for the client to remember only to use HTTPS."
  122. type = number
  123. default = 31557600
  124. }
  125. variable "healthcheck_expected_response" {
  126. description = "Response to expect from a healthy endpoint."
  127. type = number
  128. default = 200
  129. }
  130. variable "datadog" {
  131. description = "Whether to send logging info to Datadog"
  132. type = bool
  133. default = false
  134. }
  135. variable "datadog_token" {
  136. description = "API key from Datadog."
  137. type = string
  138. default = ""
  139. sensitive = true
  140. }
  141. variable "datadog_service" {
  142. description = "Datadog service name to use for logs"
  143. type = string
  144. default = "fastly"
  145. }
  146. variable "datadog_region" {
  147. description = "The region that log data will be sent to."
  148. type = string
  149. default = "EU"
  150. validation {
  151. condition = contains(["US", "EU"], var.datadog_region)
  152. error_message = "Datadog region must be either US or EU."
  153. }
  154. }
  155. variable "android_deep_link" {
  156. description = "Enable assets for Android deep link"
  157. type = bool
  158. default = true
  159. }
  160. variable "fastly_globeviz_url" {
  161. description = "URL to send traffic data for fastly for their Global Visualization page"
  162. type = string
  163. default = ""
  164. }
  165. variable "apex_redirect" {
  166. description = "Enable Fastly Apex redirection"
  167. type = bool
  168. default = true
  169. }
  170. variable "static_cache_control" {
  171. description = "Add cache-control headers for static files"
  172. type = bool
  173. default = true
  174. }
  175. variable "mastodon_error_page" {
  176. description = "Whether to enable the official mastodon error page."
  177. type = bool
  178. default = true
  179. }
  180. variable "tarpit" {
  181. description = "Whether to enable tarpit (anti-abuse rate limiting)."
  182. type = bool
  183. default = true
  184. }
  185. variable "apple_associated_domain" {
  186. description = "Enable associated domain for Apple apps"
  187. type = bool
  188. default = true
  189. }
  190. variable "vcl_snippets" {
  191. description = "Additional custom VCL snippets to add to the service."
  192. type = list(object({
  193. content = string
  194. name = string
  195. type = string
  196. priority = optional(number, 100)
  197. }))
  198. default = []
  199. }
  200. variable "edge_security" {
  201. description = "Whether to enable the Edge Security blocklist."
  202. type = bool
  203. default = true
  204. }
  205. variable "gzip_default_policy" {
  206. description = "Whether to enable Fastly's default gzip policy"
  207. type = bool
  208. default = false
  209. }
  210. variable "dynamic_compression" {
  211. description = "Whether to dynamically compress responses before sending them"
  212. type = bool
  213. default = true
  214. }
  215. variable "product_enablement" {
  216. description = "Which additional Fastly products to enable for this service."
  217. type = object({
  218. brotli_compression = optional(bool, false)
  219. domain_inspector = optional(bool, false)
  220. image_optimizer = optional(bool, false)
  221. origin_inspector = optional(bool, false)
  222. websockets = optional(bool, false)
  223. })
  224. default = {
  225. brotli_compression = false
  226. domain_inspector = false
  227. image_optimizer = false
  228. origin_inspector = false
  229. websockets = false
  230. }
  231. }
  232. # IP block lists
  233. variable "ip_blocklist" {
  234. description = "Whether to enable the IP Blocklist ACL. Must be managed externally, unless ip_blocklist_items is given."
  235. type = bool
  236. default = true
  237. }
  238. variable "ip_blocklist_items" {
  239. description = "List of IP CIDRs to block. This will make the ACL object 'managed' by terraform."
  240. type = list(string)
  241. default = []
  242. validation {
  243. condition = can([for s in var.ip_blocklist_items : regex("^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$", s)])
  244. error_message = "Each list item must be in a CIDR block format. Example: [\"10.106.108.0/25\"]."
  245. }
  246. }
  247. variable "ip_blocklist_name" {
  248. description = "Name for the ACL responsible for holding all the blocked IP ranges."
  249. type = string
  250. default = "IP Block list"
  251. }
  252. # AS block lists
  253. variable "as_blocklist" {
  254. description = "Whether to enable the AS blocklist ACLs. Must be managed externally, unless as_blocklist_items is given."
  255. type = bool
  256. default = true
  257. }
  258. variable "as_blocklist_items" {
  259. description = "List of Autonomous Systems (AS) to block. This will make the Dictionary object 'managed' by terraform."
  260. type = list(number)
  261. default = []
  262. }
  263. variable "as_blocklist_name" {
  264. description = "Name of the AS blocklist"
  265. type = string
  266. default = "AS Blocklist"
  267. }
  268. variable "as_request_blocklist_items" {
  269. description = "List of Autonomous Systems (AS) to block from making /api or /explore requests. This will make the Dictionary object 'managed' by terraform."
  270. type = list(number)
  271. default = []
  272. }
  273. variable "as_request_blocklist_name" {
  274. description = "Name of the AS request blocklist"
  275. type = string
  276. default = "AS Requests Blocklist"
  277. }
  278. # JA3 block list
  279. variable "ja3_blocklist" {
  280. description = "Whether to enable the JA3 Blocklist Dictionary. Must be managed externally, unless ja3_blocklist_items is given."
  281. type = bool
  282. default = true
  283. }
  284. variable "ja3_blocklist_items" {
  285. description = "List of JA3 hashes to block. This will make the Dictionary object 'managed' by terraform."
  286. type = list(string)
  287. default = []
  288. }
  289. variable "ja3_blocklist_name" {
  290. description = "Name for the Dictionray responsible for holding all the blocked JA3 hashes."
  291. type = string
  292. default = "JA3 Blocklist"
  293. }
  294. # Signal Sciences
  295. variable "signal_science_host" {
  296. description = "Hostname to use to integrate with Signal Sciences"
  297. type = string
  298. default = ""
  299. }
  300. variable "signal_science_shared_key" {
  301. description = "Shared key to use when integrating with Signal Sciences"
  302. type = string
  303. default = ""
  304. }
  305. # Globeviz
  306. variable "globeviz_service" {
  307. description = "Enables sending traffic information to Fastly's Globeviz page using the given service."
  308. type = string
  309. default = ""
  310. }