-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
79 lines (64 loc) · 2.21 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
variable "api" {
description = "ID of the API Gateway."
type = string
}
variable "api_gateway_type" {
description = "The type of the API Gateway to create. Valid values are REST (v1) or HTTP (v2). Defaults to REST."
type = string
validation {
condition = contains(["REST", "HTTP"], var.api_gateway_type)
error_message = "api_gateway_type must be either REST or HTTP."
}
}
variable "methods" {
description = "List of permitted HTTP methods. OPTIONS is added by default."
type = list(string)
validation {
condition = alltrue([for method in var.methods : contains(["GET", "POST", "PUT", "DELETE", "HEAD", "PATCH", "OPTIONS"], method)])
error_message = "Methods must be a list of valid HTTP methods."
}
validation {
condition = length(var.methods) > 0
error_message = "At least one method needs to be supplied."
}
}
variable "allowed_origins" {
description = "A list of allowed origins. REST API only support a single origin."
type = list(string)
validation {
condition = length(var.allowed_origins) >= 1
error_message = "At least one allowed origin must be specified."
}
}
variable "disable_default_headers" {
description = "Whether to disable the default headers. Defaults to false."
type = bool
default = false
}
variable "allowed_headers" {
description = "A list of additionally allowed headers. If you are using Access-Control-Allow-Headers as a wildcard, you must specify ['*'] explicitly."
type = list(string)
default = []
}
# ______ _____ _____ _____
# | ___ \ ___/ ___|_ _|
# | |_/ / |__ \ `--. | |
# | /| __| `--. \ | |
# | |\ \| |___/\__/ / | |
# \_| \_\____/\____/ \_/
#
# These variables are only used for REST (v1) API Gateways.
variable "rest_resources" {
description = "List of the IDs of an aws_api_gateway_resource resource. This must be set if api_gateway_type is REST."
type = list(string)
default = []
# This validation sits in the local REST module.
}
# _ _ _____ ___________
# | | | |_ _|_ _| ___ \
# | |_| | | | | | | |_/ /
# | _ | | | | | | __/
# | | | | | | | | | |
# \_| |_/ \_/ \_/ \_|
#
# These variables are only used for HTTP (v2) API Gateways.