This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvariables.tf
222 lines (189 loc) · 4.97 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
variable "file_name" {
description = "Lambda function filename name"
type = string
default = null
}
variable "image_uri" {
description = "ECR image URI containing the function's deployment package"
type = string
default = null
}
variable "image_config" {
description = "Container image configuration values that override the values in the container image Dockerfile."
type = object({
command = list(string)
entry_point = list(string)
working_directory = string
})
default = null
}
variable "s3_bucket" {
description = "S3 bucket name where lambda package is stored"
default = null
type = string
}
variable "s3_key" {
description = "S3 key where lambda package is stored"
default = null
type = string
}
variable "s3_object_version" {
description = "S3 object version of the lambda package"
default = null
type = string
}
variable "layers" {
description = "List of layers for this lambda function"
type = list(string)
default = []
}
variable "function_name" {
description = "Lambda function name"
type = string
}
variable "handler" {
description = "Lambda function handler"
type = string
default = null
}
variable "role" {
description = "Lambda function role"
type = string
}
variable "description" {
description = "Lambda function description"
default = "Managed by Terraform"
type = string
}
variable "memory_size" {
description = "Lambda function memory size"
default = 128
type = number
}
variable "runtime" {
description = "Lambda function runtime"
default = "nodejs14.x"
type = string
}
variable "timeout" {
description = "Lambda function runtime"
default = 300
type = number
}
variable "publish" {
description = "Publish lambda function"
default = false
type = bool
}
variable "vpc_config" {
description = "Lambda VPC configuration"
type = object({
subnet_ids : list(string)
security_group_ids : list(string)
})
default = {
subnet_ids : []
security_group_ids : []
}
}
variable "environment" {
description = "Lambda environment variables"
type = map(string)
default = null
}
variable "trigger" {
description = "Trigger configuration for this lambda function"
type = any
validation {
condition = contains([
"api-gateway",
"cloudwatch-logs",
"cognito-idp",
"cloudwatch-event-schedule",
"cloudwatch-event-trigger",
"sqs",
"sqs-external",
"step-function",
"kinesis",
"null",
], var.trigger.type)
error_message = "Unknown trigger type."
}
}
variable "cloudwatch_log_subscription" {
description = "Cloudwatch log stream configuration"
type = object({
enable : bool
filter_pattern : string
destination_arn : string
})
default = {
enable : false
filter_pattern : ""
destination_arn : ""
}
}
variable "tags" {
description = "Tags for this lambda function"
default = {}
type = map(string)
}
variable "reserved_concurrent_executions" {
description = "Reserved concurrent executions for this lambda function"
default = -1
type = number
}
variable "region" {
description = "AWS region"
type = string
}
variable "cloudwatch_log_retention" {
description = "Enable Cloudwatch logs retention"
default = 90
type = number
}
locals {
_tags = {
Name = var.function_name
environment = terraform.workspace
}
}
locals {
source_code_hash = var.file_name != null ? filebase64sha256(var.file_name) : null
tags = merge(var.tags, local._tags)
cloudwatch_log_group_name = "/aws/lambda/${var.function_name}"
}
variable "tracing_config" {
type = object({
mode : string
})
default = {
mode = "PassThrough"
}
description = "https://www.terraform.io/docs/providers/aws/r/lambda_function.html"
}
variable "kinesis_configuration" {
description = "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping"
type = map(object({
batch_size = number
bisect_batch_on_function_error = bool
destination_config__on_failure__destination_arn = string
event_source_arn = string
maximum_batching_window_in_seconds = number
maximum_record_age_in_seconds = number
maximum_retry_attempts = number
parallelization_factor = number
starting_position = string
starting_position_timestamp = string
tumbling_window_in_seconds = number
}))
default = {}
}
variable "sqs_external" {
description = "External SQS to consume"
type = object({
batch_size = number
sqs_arns = list(string)
})
default = null
}