-
Notifications
You must be signed in to change notification settings - Fork 3
/
variables.tf
165 lines (137 loc) · 5.52 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
#---------------------------------------------------------------------------------------------------
# General
#---------------------------------------------------------------------------------------------------
variable "naming_prefix" {
type = string
description = "Naming prefix used to name all resources"
}
variable "lambda_description" {
description = "Lambda function description."
type = string
default = "This function sends AWS cost notifications. Source: github.com/cloudandthings/terraform-aws-costnotifier"
}
variable "tags" {
description = "A mapping of tags to assign to the resources."
type = map(string)
default = {}
}
variable "cloudwatch_logs_retention_in_days" {
description = "Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653."
type = number
default = 14
}
variable "lambda_runtime" {
type = string
description = "The lambda runtime to use. One of: `[\"python3.9\", \"python3.8\", \"python3.7\"]`"
default = "python3.8"
validation {
condition = contains([
"python3.9",
"python3.8",
"python3.7"
], var.lambda_runtime)
error_message = "Invalid lambda_runtime provided."
}
}
#---------------------------------------------------------------------------------------------------
# Notifications
#---------------------------------------------------------------------------------------------------
variable "account_name" {
type = string
description = "Name of your account to Identify your account in the notification message"
}
variable "notification_schedule" {
type = string
description = "CRON expression to schedule notification"
default = "cron(0 20 ? * MON-SUN *)"
}
variable "webhook_urls" {
type = list(string)
description = "Webhook URLs to receive daily cost notifications on either Slack or Teams"
# Slack URLs are sensitive, for example
sensitive = true
}
variable "webhook_type" {
description = "Either \"slack\" or \"teams\"."
type = string
default = "slack"
validation {
condition = contains(["slack", "teams"], lower(var.webhook_type))
error_message = "Must be one of: \"slack\", \"teams\"."
}
}
variable "emails_for_notifications" {
type = list(string)
description = "List of emails to receive cost notifier notifications"
default = []
}
#---------------------------------------------------------------------------------------------------
# Thresholds
#---------------------------------------------------------------------------------------------------
variable "amber_threshold" {
type = string
description = "Percentage exceeded threshold to send an amber alert and notify the slack channel"
default = "20"
}
variable "red_threshold" {
type = string
description = "Percentage exceeded threshold to send a red alert and notify the slack channel"
default = "50"
}
#---------------------------------------------------------------------------------------------------
# IAM
#---------------------------------------------------------------------------------------------------
variable "create_role" {
description = "Controls whether IAM role for Lambda Function should be created"
type = bool
default = true
}
variable "lambda_role" {
description = "IAM role ARN attached to the Lambda Function. This governs both who / what can invoke your Lambda Function, as well as what resources our Lambda Function has access to. See Lambda Permission Model for more details."
type = string
default = ""
}
variable "permissions_boundary" {
description = "ARN of the policy that is used to set the permissions boundary for the role."
type = string
default = null
}
#---------------------------------------------------------------------------------------------------
# Network
#---------------------------------------------------------------------------------------------------
variable "security_group_ids" {
description = "List of VPC security group IDs associated with the Lambda function."
type = list(string)
default = []
}
variable "subnet_ids" {
description = "List of VPC subnet IDs associated with the Lambda function."
type = list(string)
default = []
}
#---------------------------------------------------------------------------------------------------
# KMS
#---------------------------------------------------------------------------------------------------
variable "kms_key_arn" {
description = "The alias, alias ARN, key ID, or key ARN of an AWS KMS key used to encrypt all resources."
type = string
default = null
}
#---------------------------------------------------------------------------------------------------
# Deployment
#---------------------------------------------------------------------------------------------------
variable "s3_bucket" {
description = "S3 bucket for deployment package."
type = string
default = null
}
variable "s3_key" {
description = "S3 object key for deployment package. Otherwise, defaults to `var.naming_prefix/local.deployment_filename`."
type = string
default = null
}
variable "upload_deployment_to_s3" {
description = "If `true`, the deployment package within this module repo will be copied to S3. If `false` then the S3 object must be uploaded separately. Ignored if `s3_bucket` is null."
type = bool
default = true
}