-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
184 lines (159 loc) · 5.72 KB
/
Copy pathvariables.tf
File metadata and controls
184 lines (159 loc) · 5.72 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
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
variable "allowed_aws_principals" {
description = "Optional, list of AWS accounts able to publish via the SNS topic (when creating topic) e.g 123456789012"
type = list(string)
default = []
validation {
condition = alltrue([
for p in var.allowed_aws_principals : can(regex("^[0-9]{6,}$", p))
])
error_message = "List must be a valid set of AWS account ids - only the ID not the iam"
}
}
variable "allowed_aws_services" {
description = "Optional, list of AWS services able to publish via the SNS topic (when creating topic) e.g cloudwatch.amazonaws.com"
type = list(string)
default = []
validation {
condition = alltrue([
for s in var.allowed_aws_services : can(regex(".+.amazonaws.com$", s))
])
error_message = "List must be a valid set of AWS services"
}
}
variable "cloudwatch_log_group_class" {
description = "The class of the CloudWatch log group"
type = string
default = "STANDARD"
}
variable "cloudwatch_log_group_kms_key_id" {
description = "The KMS key id to use for encrypting the cloudwatch log group (default is none)"
type = string
default = null
}
variable "cloudwatch_log_group_retention" {
description = "The retention period for the cloudwatch log group (for lambda function logs) in days"
type = number
default = 14
}
variable "create_sns_topic" {
description = "Whether to create an SNS topic for notifications"
type = bool
default = false
}
variable "email" {
description = "The configuration for Email notifications"
type = object({
addresses = optional(list(string))
# The email addresses to send notifications to
})
default = null
validation {
condition = alltrue([
for e in coalesce(var.email, { addresses = [] }).addresses : can(regex("^.+@.+$", e))
])
error_message = "Invalid email address"
}
}
variable "ephemeral_storage_size" {
description = "Amount of ephemeral storage (/tmp) in MB your Lambda Function can use at runtime"
type = number
default = 512
}
variable "function_name" {
description = "Name of the Lambda function"
type = string
default = "lz-notifications"
}
variable "lambda_log_level" {
description = "The log level for the Lambda function"
type = string
default = "INFO"
}
variable "lambda_role_description" {
description = "Description of the IAM role for the Lambda function"
type = string
default = "Used by the notifications lambda to forward alarms on to slack or teams"
}
variable "lambda_role_name" {
description = "Name of the IAM role for the Lambda function"
type = string
default = null
}
variable "lambda_runtime" {
description = "The runtime to use for the Lambda function"
type = string
default = "python3.13"
}
variable "lambda_role_permissions_boundary" {
description = "ARN of the permissions boundary to be used on the Lambda IAM role"
type = string
default = null
}
variable "memory_size" {
description = "Amount of memory in MB your Lambda Function can use at runtime"
type = number
default = 128
}
variable "slack" {
description = "The configuration for Slack notifications"
type = object({
lambda_name = optional(string, "slack-notify")
# The name of the lambda function to create
lambda_description = optional(string, "Lambda function to send slack notifications")
# An optional secret name in secrets manager to use for the slack configuration
webhook_url = optional(string)
# An optional ARN for a secret in secrets manager containing the webhook url details
webhook_arn = optional(string, null)
})
default = null
}
variable "sns_topic_name" {
description = "The name of the source sns topic where events are published"
type = string
validation {
condition = can(regex("^[a-zA-Z0-9_-]{1,256}$", var.sns_topic_name))
error_message = "Invalid SNS topic name"
}
}
variable "sns_topic_policy" {
description = "The policy to attach to the sns topic, else we default to account root"
type = string
default = null
}
variable "subscribers" {
description = "Optional list of custom subscribers to the SNS topic"
type = map(object({
protocol = string
# The protocol to use. The possible values for this are: sqs, sms, lambda, application. (http or https are partially supported, see below).
endpoint = string
# The endpoint to send data to, the contents will vary with the protocol. (see below for more information)
endpoint_auto_confirms = bool
# Boolean indicating whether the end point is capable of auto confirming subscription e.g., PagerDuty (default is false)
raw_message_delivery = bool
# Boolean indicating whether or not to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property) (default is false)
}))
default = {}
}
variable "tags" {
description = "Tags to apply to all resources"
type = map(string)
default = {}
}
variable "teams" {
description = "The configuration for teams notifications"
type = object({
lambda_name = optional(string, "teams-notify")
# The name of the lambda function to create
lambda_description = optional(string, "Lambda function to send teams notifications")
# An optional secret name in secrets manager to use for the slack configuration
webhook_url = optional(string)
# An optional ARN for a secret in secrets manager containing the webhook url details
webhook_arn = optional(string, null)
})
default = null
}
variable "timeout" {
description = "The amount of time your Lambda Function has to run in seconds"
type = number
default = 30
}