-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvariables.tf
More file actions
296 lines (255 loc) · 9.32 KB
/
Copy pathvariables.tf
File metadata and controls
296 lines (255 loc) · 9.32 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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
variable "region" {
type = string
description = "AWS Region"
}
variable "subnet_ids" {
description = "List of subnet IDs to use when deploying the Lambda Function in a VPC"
type = list(string)
default = null
}
variable "security_group_ids" {
description = "List of security group IDs to use when the Lambda Function runs in a VPC"
type = list(string)
default = null
}
#https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html
variable "lambda_reserved_concurrent_executions" {
type = number
description = "Amount of reserved concurrent executions for the lambda function. A value of 0 disables Lambda from being triggered and -1 removes any concurrency limitations. Defaults to Unreserved Concurrency Limits -1"
default = -1
}
variable "lambda_runtime" {
type = string
description = "Runtime environment for Datadog Lambda"
default = "python3.11"
}
variable "lambda_architectures" {
type = list(string)
description = "Instruction set architecture for the Datadog Lambda function. Valid values are [\"x86_64\"] and [\"arm64\"]. Set to [\"arm64\"] when using Datadog Forwarder 5.x artifacts."
default = null
validation {
condition = var.lambda_architectures == null ? true : alltrue([for a in var.lambda_architectures : contains(["x86_64", "arm64"], a)])
error_message = "lambda_architectures must be null or a list containing only \"x86_64\" and/or \"arm64\"."
}
}
variable "tracing_config_mode" {
type = string
description = "Can be either PassThrough or Active. If PassThrough, Lambda will only trace the request from an upstream service if it contains a tracing header with 'sampled=1'. If Active, Lambda will respect any tracing header it receives from an upstream service"
default = "PassThrough"
}
variable "dd_api_key_kms_ciphertext_blob" {
type = string
description = "CiphertextBlob stored in environment variable DD_KMS_API_KEY used by the lambda function, along with the KMS key, to decrypt Datadog API key"
default = ""
}
variable "dd_artifact_filename" {
type = string
description = "The Datadog artifact filename minus extension"
default = "aws-dd-forwarder"
}
variable "dd_module_name" {
type = string
description = "The Datadog GitHub repository name"
default = "datadog-serverless-functions"
}
variable "dd_forwarder_version" {
type = string
description = "Version tag of Datadog lambdas to use. https://github.com/DataDog/datadog-serverless-functions/releases"
default = "3.116.0"
}
variable "forwarder_log_enabled" {
type = bool
description = "Flag to enable or disable Datadog log forwarder"
default = false
}
variable "forwarder_rds_enabled" {
type = bool
description = "Flag to enable or disable Datadog RDS enhanced monitoring forwarder"
default = false
}
variable "forwarder_vpc_logs_enabled" {
type = bool
description = "Flag to enable or disable Datadog VPC flow log forwarder"
default = false
}
variable "forwarder_log_retention_days" {
type = number
description = "Number of days to retain Datadog forwarder lambda execution logs. One of [0 1 3 5 7 14 30 60 90 120 150 180 365 400 545 731 1827 3653]"
default = 14
}
variable "forwarder_use_cache_bucket" {
type = bool
description = "Flag to enable or disable the cache bucket for lambda tags and failed events. See https://docs.datadoghq.com/logs/guide/forwarder/?tab=cloudformation#upgrade-an-older-version-to-31060. Recommended for forwarder versions 3.106 and higher."
default = true
}
variable "kms_key_id" {
type = string
description = "Optional KMS key ID to encrypt Datadog Lambda function logs"
default = null
}
variable "s3_buckets" {
type = list(string)
description = "The names of S3 buckets to forward logs to Datadog"
default = []
}
variable "s3_buckets_with_prefixes" {
type = map(object({ bucket_name : string, bucket_prefix : string }))
description = "The names S3 buckets and prefix to forward logs to Datadog"
default = {}
}
variable "s3_notification_events" {
type = list(string)
description = "List of S3 events to trigger the Lambda notification"
default = []
}
variable "s3_bucket_kms_arns" {
type = list(string)
description = "List of KMS key ARNs for s3 bucket encryption"
default = []
}
variable "cloudwatch_forwarder_log_groups" {
type = map(map(string))
description = <<EOT
Map of CloudWatch Log Groups with a filter pattern that the Lambda forwarder will send logs from. For example: { mysql1 = { name = "/aws/rds/maincluster", filter_pattern = "" }
EOT
default = {}
}
variable "cloudwatch_forwarder_event_patterns" {
type = map(object({
version = optional(list(string))
id = optional(list(string))
detail-type = optional(list(string))
source = optional(list(string))
account = optional(list(string))
time = optional(list(string))
region = optional(list(string))
resources = optional(list(string))
detail = optional(map(list(string)))
}))
description = <<-EOF
Map of title to CloudWatch Event patterns to forward to Datadog. Event structure from here: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html#CloudWatchEventsPatterns
Example:
```hcl
cloudwatch_forwarder_event_rules = {
"guardduty" = {
source = ["aws.guardduty"]
detail-type = ["GuardDuty Finding"]
}
"ec2-terminated" = {
source = ["aws.ec2"]
detail-type = ["EC2 Instance State-change Notification"]
detail = {
state = ["terminated"]
}
}
}
```
EOF
default = {}
}
variable "forwarder_lambda_debug_enabled" {
type = bool
description = "Whether to enable or disable debug for the Lambda forwarder"
default = false
}
variable "vpclogs_cloudwatch_log_group" {
type = string
description = "The name of the CloudWatch Log Group for VPC flow logs"
default = null
}
variable "forwarder_rds_artifact_url" {
type = string
description = "The URL for the code of the Datadog forwarder for RDS. It can be a local file, url or git repo"
default = null
}
variable "forwarder_vpc_logs_artifact_url" {
type = string
description = "The URL for the code of the Datadog forwarder for VPC Logs. It can be a local file, url or git repo"
default = null
}
variable "forwarder_log_artifact_url" {
type = string
description = "The URL for the code of the Datadog forwarder for Logs. It can be a local file, URL or git repo"
default = null
}
variable "lambda_policy_source_json" {
type = string
description = "Additional IAM policy document that can optionally be passed and merged with the created policy document"
default = ""
}
variable "forwarder_log_layers" {
type = list(string)
description = "List of Lambda Layer Version ARNs (maximum of 5) to attach to Datadog log forwarder lambda function"
default = []
}
variable "forwarder_rds_layers" {
type = list(string)
description = "List of Lambda Layer Version ARNs (maximum of 5) to attach to Datadog RDS enhanced monitoring lambda function"
default = []
}
variable "forwarder_vpc_logs_layers" {
type = list(string)
description = "List of Lambda Layer Version ARNs (maximum of 5) to attach to Datadog VPC flow log forwarder lambda function"
default = []
}
variable "forwarder_rds_filter_pattern" {
type = string
description = "Filter pattern for Lambda forwarder RDS"
default = ""
}
variable "forwarder_vpclogs_filter_pattern" {
type = string
description = "Filter pattern for Lambda forwarder VPC Logs"
default = ""
}
variable "dd_tags_map" {
type = map(string)
description = "A map of Datadog tags to apply to all logs forwarded to Datadog"
default = {}
}
variable "context_tags_enabled" {
type = bool
description = "Whether to add context tags to add to each monitor"
default = true
}
variable "context_tags" {
type = set(string)
description = "List of context tags to add to each monitor"
default = ["namespace", "tenant", "environment", "stage"]
}
variable "lambda_arn_enabled" {
type = bool
description = "Enable adding the Lambda Arn to this account integration"
default = true
}
# No Datasource for this (yet?)
/**
curl -X GET "${DD_API_URL}/api/v1/integration/aws/logs/services" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" | jq '.[] | .id'
**/
variable "log_collection_services" {
type = list(string)
description = "List of log collection services to enable"
default = [
"apigw-access-logs",
"apigw-execution-logs",
"elbv2",
"elb",
"cloudfront",
"lambda",
"redshift",
"s3"
]
}
variable "datadog_forwarder_lambda_environment_variables" {
type = map(string)
default = {}
description = "Map of environment variables to pass to the Lambda Function"
}
variable "datadog_configuration_environment" {
type = string
description = "AWS region where the Datadog configuration is deployed, useful for multi region setups, null uses default (gbl)"
default = null
}