generated from appvia/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
176 lines (154 loc) · 5.94 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
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 "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 "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 "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 "sns_topic_policy" {
description = "The policy to attach to the sns topic, else we default to account root"
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 = string
default = "0"
}
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 "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")
# The description for the slack lambda
secret_name = optional(string)
# An optional secret name in secrets manager to use for the slack configuration
webhook_url = optional(string)
# The webhook url to post to
filter_policy = optional(string)
# An optional SNS subscription filter policy to apply
filter_policy_scope = optional(string)
# If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"
})
default = null
}
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")
# The description for the teams lambda
secret_name = optional(string)
# An optional secret name in secrets manager to use for the slack configuration
webhook_url = optional(string)
# The webhook url to post to
filter_policy = optional(string)
# An optional SNS subscription filter policy to apply
filter_policy_scope = optional(string)
# If filter policy provided this is the scope of that policy; either "MessageAttributes" (default) or "MessageBody"
})
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)
}
variable "enable_slack" {
description = "To send to slack, set to true"
type = bool
default = false
}
variable "enable_teams" {
description = "To send to teams, set to true"
type = bool
default = false
}
variable "accounts_id_to_name" {
description = "A mapping of account id and account name - used by notification lamdba to map an account ID to a human readable name"
type = map(string)
default = {}
}
variable "post_icons_url" {
description = "URLs (not base64 encoded!) to publically available icons for highlighting posts of error and/or warning status. Ideally 50px square. Set to non-existent URLs to disable icons"
type = object({
error_url = string
warning_url = string
})
default = {
error_url = "https://raw.githubusercontent.com/appvia/terraform-aws-notifications/main/resources/posts-attention-icon.png"
warning_url = "https://raw.githubusercontent.com/appvia/terraform-aws-notifications/main/resources/posts-warning-icon.png"
}
}
variable "identity_center_start_url" {
description = "The start URL of your Identity Center instance"
type = string
default = null
}
variable "identity_center_role" {
description = "The name of the role to use when redirecting through Identity Center"
type = string
default = null
}