-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
179 lines (156 loc) · 4.92 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
variable "lambda_name" {
type = string
description = "The lambda name and anything else."
}
variable "lambda_runtime" {
type = string
description = "The lambda runtime engine, see @https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime."
}
variable "lambda_handler" {
type = string
description = "The entrypoint of the lambda application, with the fully qualify name of the method, for example src/main.handler."
}
variable "exclude_files" {
default = []
type = list(string)
description = "Files list to exclude from the zip"
}
variable "source_dir" {
type = string
default = "src"
description = "Source of the lambda code, it can be a simple directory or an already zipped one. Default src."
}
variable "architecture" {
type = string
default = "x86_64"
description = "The platform architecture, valid values are x86_64 and arm64. Default x86_64."
validation {
condition = var.architecture == "x86_64" || var.architecture == "arm64"
error_message = "Invalid architecture, allowed values x86_64 or arm64."
}
}
variable "concurrent_execution" {
type = number
default = -1
description = "Amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. Defaults to Unreserved Concurrency Limits -1"
}
variable "memory_size" {
default = 128
type = number
description = " Amount of memory in MB your Lambda Function can use at runtime. Valid values are 128, 256, 512, 1024, 2048. Defaults to 128."
validation {
condition = contains( [128, 256, 512, 1024, 2048], tonumber(var.memory_size) )
error_message = "Invalid memory size, allowed values are 128, 256, 512, 1024, 2048."
}
}
variable "timeout" {
default = 5
type = number
description = "Amount of time your Lambda Function has to run in seconds. Defaults to 5."
}
variable "environment_variables" {
type = map(string)
default = {}
description = "Map of environment variables that are accessible from the function code during execution."
}
variable "trigger" {
type = object({
s3 : optional(object({
bucket : string,
events : list(string),
filter_prefix : string,
filter_suffix : string
}))
apigateway : optional(object({
type : string,
existing_api_id : optional(string)
disable_test_endpoint : optional(bool)
resource_policy : optional(string)
cors_configuration : optional(object({
allow_headers : set(string)
allow_method : set(string)
allow_origins : set(string)
max_age : number
}))
authorizer : optional(object({
name : string,
identity_source : string,
jwt : optional(object({
aud : list(string),
issuer : string
}))
}))
routes : list(object({
path : string,
method : string,
authorizer : optional(bool)
}))
}))
#TODO alb trigger objejct
alb : optional(string)
})
default = null
description = "Trigger object variable. It can specify sqs, apigateway with route and authorizer, sqs or s3 trigger."
}
variable "tracing_mode" {
type = string
default = null
description = "The XRAY service integration. It can be Active or PassThrough. Default disabled."
validation {
condition = var.tracing_mode == null || var.tracing_mode == "Active" || var.tracing_mode == "PassThrough"
error_message = "Allowed values are Active and PassThrough."
}
}
variable "log_retention" {
type = number
default = 90
description = "The cloudwatch log retention. Default 90."
}
variable "stage_name" {
type = string
default = "api"
}
variable "iam_policies" {
type = list(object({
actions = list(string),
resources = list(string)
}))
default = []
description = "List of IAM policy for the lambda"
}
variable "vpc_mode" {
type = object({
id : string,
subnet_ids : list(string)
security_group = optional(object({
ingress = optional(list(object({
from_port = number
to_port = number
protocol = string
cidr_blocks = optional(list(string))
security_groups = optional(list(string))
})))
egress = optional(list(object({
from_port = number
to_port = number
protocol = string
cidr_blocks = optional(list(string))
security_groups = optional(list(string))
})))
}))
})
default = null
description = "Use it to enable Lambda to run in VPC. Default disabled."
}
variable "alarm_topic" {
type = string
default = null
description = "Topic for alarms notification"
}
variable "alarm_metric" {
default = null
type = object({
threshold = string
period = string
})
}