-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
297 lines (248 loc) · 7.25 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
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
297
# Required Variables
variable "prefix" {
type = string
description = "This will be the prefix used to name the Resources."
}
# Optional Variables
variable "env" {
type = string
description = "Dev/Prod/Staging or any other custom environment name."
default = "dev"
}
variable "snowalert_warehouse_name" {
type = string
description = "Warehouse for snowalert."
default = "SNOWALERT_WAREHOUSE"
}
variable "snowalert_database_name" {
type = string
description = "Database that will be created for all the Snowalert objects."
default = "SNOWALERT"
}
variable "snowalert_user_name" {
type = string
description = "User used to grant ownership to all Snowalert objects."
default = "APP_SNOWALERT"
}
variable "aws_region" {
description = "The AWS region in which the AWS infrastructure is created."
default = "us-west-2"
}
variable "aws_cloudwatch_metric_namespace" {
type = string
description = "prefix for CloudWatch Metrics that GEFF writes"
default = "*"
}
variable "log_retention_days" {
description = "Log retention period in days."
default = 0 # Forever
}
variable "snowflake_integration_user_roles" {
type = list(string)
default = []
description = "List of roles to which GEFF infra will GRANT USAGE ON INTEGRATION perms."
}
variable "deploy_lambda_in_vpc" {
type = bool
description = "The security group VPC ID for the lambda function."
default = false
}
variable "lambda_security_group_ids" {
type = list(string)
default = []
description = "The security group IDs for the lambda function."
}
variable "lambda_subnet_ids" {
type = list(string)
default = []
description = "The subnet IDs for the lambda function."
}
variable "geff_image_version" {
type = string
description = "Version of the GEFF docker image."
default = "latest"
}
variable "data_bucket_arns" {
type = list(string)
default = []
description = "List of Bucket ARNs for the s3_reader role to read from."
}
variable "create_warehouse" {
type = bool
default = false
description = "Flag to create warehouse or not."
}
variable "create_database" {
type = bool
default = false
description = "Flag to create database or not."
}
variable "create_user" {
type = bool
default = false
description = "Flag to create user or not."
}
variable "snowalert_user_email" {
type = string
default = null
description = "Email of the snowalert Snowflake user."
}
variable "create_role" {
type = bool
default = false
description = "Flag to create role or not."
}
variable "create_schemas" {
type = bool
default = false
description = "Flag to create schemas within the module or not."
}
variable "use_managed_schema" {
type = bool
default = true
description = "Flag to create schemas within the module or not."
}
variable "create_tables" {
type = bool
default = false
description = "Flag to create tables within the module or not."
}
variable "handlers" {
type = list(string)
description = "List of handlers to enable."
default = []
}
# Correspoding variables of the specified handlers are required
variable "jira_secrets_arn" {
type = string
description = "Secrets for JIRA in the specified format with host pinned."
default = null
}
variable "slack_secrets_arn" {
type = string
description = "Secrets for slack in the specified format with host pinned."
default = null
}
variable "smtp_secrets_arn" {
type = string
description = "Secrets for SMTP server in the specified format with host pinned."
default = null
}
variable "smtp_driver_from_email_address" {
type = string
description = "."
default = null
}
variable "jira_url" {
type = string
default = null
description = "Fallback JIRA project for the JIRA handler."
}
variable "default_jira_project" {
type = string
default = "SA"
description = "Fallback JIRA project for the JIRA handler."
}
variable "default_jira_issue_type" {
type = string
default = "Task"
description = "Fallback Issue type for the JIRA handler."
}
variable "servicenow_secrets_arn" {
type = string
default = null
description = "Secrets for service now in the specified format with host pinned."
}
variable "servicenow_api_url" {
type = string
default = null
description = "Service Now API URL."
}
variable "snowalert_warehouse_size" {
type = string
description = "Warehouse size."
default = "XSMALL"
}
variable "alerts_merge_schedule" {
type = string
description = "Schedule for the alert merge."
default = "0 12 * * *"
}
variable "alert_dispatch_schedule" {
type = string
description = "Schedule for the alert dispatcher task."
default = "* * * * *"
}
variable "alert_scheduler_schedule" {
type = string
description = "Schedule for the alert scheduler task."
default = "1/15 * * * *"
}
variable "violation_scheduler_schedule" {
type = string
description = "Schedule for the violation scheduler task."
default = "1/15 * * * *"
}
variable "integration_role" {
type = string
description = "Role for creating database level or account level objects."
default = "INTEGRATION_OWNER_RL"
}
variable "admin_role" {
type = string
description = "Role for creating database level or account level objects."
default = "ADMIN_RL"
}
variable "alerting_role" {
type = string
description = "Role for creating schema level objects."
default = "ALERTING_RL"
}
variable "ingest_role" {
type = string
description = "Role for creating schema level objects."
default = "INGEST_RL"
}
variable "modeling_role" {
type = string
description = "Role for creating schema level objects."
default = "MODELING_RL"
}
variable "monitoring_role" {
type = string
description = "Role for creating schema level objects."
default = "MONITORING_RL"
}
variable "warehouse_external_roles" {
type = list(string)
description = "List of additional roles that need SnowAlert warehouse usage permissions."
default = []
}
variable "jira_api_version" {
type = string
description = "Version of the JIRA API to use"
default = "3"
}
variable "enable_multiple_grants" {
type = bool
description = "Allow grants outside of the terraform-snowflake-snowalert-rbac module"
default = true
}
variable "enable_alert_processor" {
type = bool
description = "Enable the alert processor for alert correlation"
default = true
}
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
data "aws_partition" "current" {}
locals {
account_id = data.aws_caller_identity.current.account_id
aws_region = data.aws_region.current.name
snowalert_secret_arns = flatten([
contains(var.handlers, "jira") == true ? [var.jira_secrets_arn] : [],
contains(var.handlers, "slack") == true ? [var.slack_secrets_arn] : [],
contains(var.handlers, "servicenow") == true ? [var.servicenow_secrets_arn] : [],
contains(var.handlers, "smtp") == true ? [var.smtp_secrets_arn] : [],
])
}