Repository navigation
Expand file tree
/
Copy pathvariables.tf
More file actions
78 lines (70 loc) · 2.73 KB
/
Copy pathvariables.tf
File metadata and controls
78 lines (70 loc) · 2.73 KB
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
variable "memory" {
type = number
default = 128
description = <<EOF
The amount of memory to reserve and cap the service.
If the service exceeds this amount, the service will be killed with exit code 127 representing "Out-of-memory".
Memory is measured in MiB, or megabytes.
This means the default is 128 MiB or 0.125 GiB.
EOF
}
variable "timeout" {
type = number
default = 3
description = <<EOF
The maximum number of seconds the service is allotted to execute.
The maximum this can be set is 900 seconds (15 minutes).
EOF
}
variable "command" {
type = list(string)
default = []
description = <<EOF
This overrides the `CMD` specified in the image.
Specify a blank list to use the image's `CMD`.
Each token in the command is an item in the list.
For example, `echo "Hello World"` would be represented as ["echo", "\"Hello World\""].
EOF
}
variable "reserved_concurrency" {
type = number
default = -1
description = <<EOF
The number of reserved concurrent executions for this Lambda function.
This guarantees a minimum amount of concurrent executions for the function.
`-1` removes limitations and `0` disables the lambda from being triggered
EOF
}
variable "snapstart" {
type = object({
enabled = optional(bool, false)
versions_to_keep = optional(number, 3)
})
default = {}
nullable = false
description = <<EOF
Configures Lambda SnapStart, which reduces cold start times.
AWS initializes the function once per deploy, snapshots it, and resumes from that snapshot on a cold start.
`enabled` turns SnapStart on. The image must opt in: AWS base images for Java 11+, Python 3.12+, and .NET 8+ work as-is;
any other image needs `LABEL com.amazonaws.lambda.feature.snapstart="Allow"` in its Dockerfile, or the deploy fails.
Deploys take longer because AWS snapshots each new version before it receives traffic.
AWS charges for each stored snapshot and for each restore.
`versions_to_keep` is the number of published versions to keep, including the one receiving traffic.
Each deploy publishes a new version and removes older ones beyond this count.
Every kept version has a stored snapshot that AWS charges for.
EOF
validation {
condition = var.snapstart.versions_to_keep >= 1
error_message = "snapstart.versions_to_keep must be at least 1."
}
}
variable "alert_thresholds" {
type = object({
error_rate = optional(number, 5)
})
default = {}
description = <<EOF
Thresholds for CloudWatch alarms on the lambda function. Only active when a notification connection is provided.
- error_rate: Percentage of invocations that error over a 5-minute period to trigger the alarm (default: 5%)
EOF
}