-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
199 lines (170 loc) · 5.23 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
/*
###################################################################################################
# Terraform Variables Configuration
#
# Description: This module creates a Glue ETL Job using Terraform.
#
# Author: Subhamay Bhattacharyya
# Created: 11-Nov-2024 Updated: 12-Nov-2024 9:44
# Version: 1.0
#
####################################################################################################
*/
######################################## AWS Configuration #########################################
variable "aws-region" {
type = string
default = "us-east-1"
}
######################################## Project Name ##############################################
variable "project-name" {
description = "The name of the project"
type = string
default = "gitops"
}
######################################## Environment Name ##########################################
variable "environment-name" {
type = string
description = <<EOF
(Optional) The environment in which to deploy our resources to.
Options:
- devl : Development
- test: Test
- prod: Production
Default: devl
EOF
default = "devl"
validation {
condition = can(regex("^devl$|^test$|^prod$", var.environment-name))
error_message = "Err: environment is not valid."
}
}
######################################## Glue Job Configuration ####################################
# Glue Job base name
variable "glue-job-base-name" {
description = "The base name of the Glue ETL Job"
type = string
}
# Glue ETL Job description
variable "glue-job-description" {
description = "The description of the Glue ETL Job"
type = string
}
# The base name of the Glue script bucket
variable "glue-script-bucket-base-name" {
description = "The base name of the Glue script S3 bucket"
type = string
}
# The Glue Job script name
variable "script-name" {
description = "The name of the Glue ETL Job script"
type = string
}
# The base name of the Glue service role
variable "glue-job-role-name" {
description = "The name of the Glue ETL Job role"
type = string
}
variable "execution-class" {
description = "The execution class of the Glue ETL Job"
type = string
default = "STANDARD"
}
# Glue ETL job version
variable "glue-version" {
description = "The version of the Glue ETL Job"
type = string
default = "1.0"
}
# Glue ETL Python version
variable "python-version" {
description = "The Python version of the Glue ETL Job"
type = string
default = "3.0"
}
# Glue ETL Job command name
variable "glue-job-command-name" {
description = <<EOF
(Optional) The command name of the Glue ETL job.
Options:
- glueetl : Glue ETL
- pythonshell: Python Shell
Default: glueetl
EOF
default = "glueetl"
validation {
condition = can(regex("^glueetl$|^pythonshell$", var.glue-job-command-name))
error_message = "Err: Glue Job command name is not valid."
}
}
# Glue ETL job timeout in minutes
variable "glue-job-timeout" {
description = "The timeout period for the Glue job"
type = number
default = 2880
}
# Glue ETL Job maximum capacity
variable "max-capacity" {
description = "Glue Job max capacity"
type = number
default = 0.0625
}
# Glue ETL job worker type
variable "worker-type" {
description = "The worker type of the Glue ETL Job"
type = string
default = null
}
# The number of workers of the Glue ETL Job
variable "number-of-workers" {
description = "The number of workers of the Glue ETL Job"
type = number
default = 2
}
variable "max-concurrent-runs" {
description = "Maximum allowed concurrent runs"
type = number
default = 1
}
# Default tags for the Glue Job
variable "tags" {
description = "A map of tags to assign to the bucket"
type = map(string)
default = {
Environment = "devl"
ProjectName = "terraform-aws-glue"
GitHubRepository = "test-repo"
GitHubRef = "refs/heads/main"
GitHubURL = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
GitHubSHA = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
# Glue Job default arguments
variable "default-arguments" {
description = "A map of default arguments used by Glue ETL Job"
type = map(string)
default = null
}
# Glue Job security configuration
variable "glue-security-configuration-name" {
description = "The security configuration name of the Glue ETL Job"
type = string
default = null
}
# Glue Job tags
variable "glue-job-tags" {
description = "A map of tags to assign to the Glue ETL Job"
type = map(string)
default = null
}
######################################## GitHub ####################################################
# The CI build string
variable "ci-build" {
description = "The CI build string"
type = string
default = "gitops"
}
######################################## Local Variables ###########################################
locals {
glue-job-name = "${var.project-name}-${var.glue-job-base-name}-${var.environment-name}-${var.aws-region}${var.ci-build}"
glue-script-bucket-name = "${var.project-name}-${var.glue-script-bucket-base-name}-${var.environment-name}-${var.aws-region}${var.ci-build}"
}