-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
100 lines (89 loc) · 4.38 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
variable "alternate_domain_name" {
type = string
default = null
description = "Domain name of a HostedZone created by the Route53 Registrar, without trailing '.'"
}
variable "tables" {
type = set(string)
default = null
description = "List of unique names (set of strings) for which the CRUD app will create a separate table."
}
variable "log_apis" {
type = bool
default = null
description = "Log API Gateway (V2) requests and reponses. A role to do so must be configured in the AWS region, see api_gateway_log_role."
}
variable "api_gateway_log_role" {
type = bool
default = null
description = "Create and set a role in this AWS region to log requests through API Gateway, careful, there can only be one."
}
variable "textract_api" {
type = bool
default = null
description = "Should a Textract API be deployed?"
}
variable "apis_rate_limit" {
type = number
default = null
description = "The maximum number of requests per second the APIs are allowed to respond to."
}
variable "crud_api_daily_usage_quota" {
type = number
default = null
description = "The maximum number of requests per day the CRUD API is allowed to respond to, makes API key usage compulsory."
}
variable "app_landing_page_name" {
type = string
default = null
description = "The URI resource name of app front end page."
}
variable "redirect_missing_file_extension_to_html" {
type = bool
default = null
description = "Redirect users querying for resource without a file extension (or just . or /) to .html."
}
variable "log_cdn_requests" {
type = bool
default = null
description = "Log requests made to the cloudfront distribution to s3."
}
variable "workspace_variables" {
type = map(object({
alternate_domain_name = string
tables = set(string)
log_apis = bool
api_gateway_log_role = bool
textract_api = bool
apis_rate_limit = number
crud_api_daily_usage_quota = number
app_landing_page_name = string
redirect_missing_file_extension_to_html = bool
log_cdn_requests = bool
}))
default = {}
}
locals {
default_vars = lookup(var.workspace_variables, terraform.workspace, {
alternate_domain_name = ""
tables = ["default"]
log_apis = false
api_gateway_log_role = false
textract_api = false
apis_rate_limit = -1 # disable throttling
crud_api_daily_usage_quota = 0 # no quote
app_landing_page_name = "index.html"
redirect_missing_file_extension_to_html = false
log_cdn_requests = false
})
alternate_domain_name = var.alternate_domain_name != null ? var.alternate_domain_name : local.default_vars["alternate_domain_name"]
tables = var.tables != null ? var.tables : local.default_vars["tables"]
log_apis = var.log_apis != null ? var.log_apis : local.default_vars["log_apis"]
api_gateway_log_role = var.api_gateway_log_role != null ? var.api_gateway_log_role : local.default_vars["api_gateway_log_role"]
textract_api = var.textract_api != null ? var.textract_api : local.default_vars["textract_api"]
apis_rate_limit = var.apis_rate_limit != null ? var.apis_rate_limit : local.default_vars["apis_rate_limit"]
crud_api_daily_usage_quota = var.crud_api_daily_usage_quota != null ? var.crud_api_daily_usage_quota : local.default_vars["crud_api_daily_usage_quota"]
app_landing_page_name = var.app_landing_page_name != null ? var.app_landing_page_name : local.default_vars["app_landing_page_name"]
redirect_missing_file_extension_to_html = var.redirect_missing_file_extension_to_html != null ? var.redirect_missing_file_extension_to_html : local.default_vars["redirect_missing_file_extension_to_html"]
log_cdn_requests = var.log_cdn_requests != null ? var.log_cdn_requests : local.default_vars["log_cdn_requests"]
}