generated from Skatteetaten/vagrant-hashistack-template
-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.tf
200 lines (179 loc) · 5.65 KB
/
main.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
locals {
nomad_datacenters = ["dc1"]
nomad_namespace = "default"
}
module "trino" {
source = "../.."
depends_on = [
module.postgres,
module.minio,
module.hive
]
# nomad
nomad_job_name = "trino"
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
# trino
vault_secret = {
use_vault_provider = true
vault_kv_policy_name = "kv-secret"
vault_kv_path = "secret/data/dev/trino"
vault_kv_field_secret_name = "cluster_shared_secret"
}
service_name = "trino"
mode = "standalone"
workers = 1
consul_http_addr = "http://10.0.3.10:8500"
debug = true
use_canary = true
hive_config_properties = [
"hive.allow-drop-table=true",
"hive.allow-rename-table=true",
"hive.allow-add-column=true",
"hive.allow-drop-column=true",
"hive.allow-rename-column=true",
"hive.compression-codec=ZSTD"]
resource = {
cpu = 500
memory = 1024
}
resource_proxy = {
cpu = 200
memory = 128
}
# other
hivemetastore_service = {
service_name = module.hive.service_name
port = module.hive.port
}
minio_service = {
service_name = module.minio.minio_service_name
port = module.minio.minio_port
access_key = module.minio.minio_access_key
secret_key = module.minio.minio_secret_key
}
minio_vault_secret = {
use_vault_provider = false
vault_kv_policy_name = ""
vault_kv_path = ""
vault_kv_field_access_name = ""
vault_kv_field_secret_name = ""
}
postgres_service = {
service_name = module.postgres.service_name
port = module.postgres.port
username = module.postgres.username
password = module.postgres.password
database_name = module.postgres.database_name
}
postgres_vault_secret = {
use_vault_provider = false
vault_kv_policy_name = ""
vault_kv_path = ""
vault_kv_field_username = ""
vault_kv_field_password = ""
}
}
module "minio" {
source = "github.com/skatteetaten/terraform-nomad-minio.git?ref=0.4.0"
# nomad
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
nomad_host_volume = "persistence-minio"
# minio
service_name = "minio"
host = "127.0.0.1"
port = 9000
container_image = "minio/minio:latest" # todo: avoid using tag latest in future releases
vault_secret = {
use_vault_provider = false,
vault_kv_policy_name = "",
vault_kv_path = "",
vault_kv_field_access_key = "",
vault_kv_field_secret_key = ""
}
access_key = "minio"
secret_key = "minio123"
buckets = ["default", "hive"]
container_environment_variables = ["JUST_EXAMPLE_VAR1=some-value", "ANOTHER_EXAMPLE2=some-other-value"]
data_dir = "/minio/data"
use_host_volume = true
use_canary = true
# mc
mc_service_name = "mc"
mc_container_image = "minio/mc:latest" # todo: avoid using tag latest in future releases
mc_container_environment_variables = ["JUST_EXAMPLE_VAR3=some-value", "ANOTHER_EXAMPLE4=some-other-value"]
}
module "postgres" {
source = "github.com/skatteetaten/terraform-nomad-postgres.git?ref=0.4.0"
# nomad
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
nomad_host_volume = "persistence-postgres"
# postgres
service_name = "postgres"
container_image = "postgres:12-alpine"
container_port = 5432
vault_secret = {
use_vault_provider = false,
vault_kv_policy_name = "",
vault_kv_path = "",
vault_kv_field_username = "",
vault_kv_field_password = ""
}
admin_user = "hive"
admin_password = "hive"
database = "metastore"
container_environment_variables = ["PGDATA=/var/lib/postgresql/data"]
volume_destination = "/var/lib/postgresql/data"
use_host_volume = true
use_canary = true
}
module "hive" {
source = "github.com/skatteetaten/terraform-nomad-hive.git?ref=0.4.0"
# nomad
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
local_docker_image = false
# hive
use_canary = true
hive_service_name = "hive-metastore"
hive_container_port = 9083
hive_docker_image = "fredrikhgrelland/hive:3.1.0"
resource = {
cpu = 500,
memory = 1024
}
resource_proxy = {
cpu = 200,
memory = 128
}
#support CSV -> https://towardsdatascience.com/load-and-query-csv-file-in-s3-with-trino-b0d50bc773c9
#metastore.storage.schema.reader.impl=org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader
hive_container_environment_variables = [
"HIVE_SITE_CONF_metastore_storage_schema_reader_impl=org.apache.hadoop.hive.metastore.SerDeStorageSchemaReader"
]
# hive - minio
hive_bucket = {
default = "default",
hive = "hive"
}
minio_service = {
service_name = module.minio.minio_service_name,
port = module.minio.minio_port,
access_key = module.minio.minio_access_key,
secret_key = module.minio.minio_secret_key,
}
# hive - postgres
postgres_service = {
service_name = module.postgres.service_name
port = module.postgres.port
database_name = module.postgres.database_name
username = module.postgres.username
password = module.postgres.password
}
depends_on = [
module.minio,
module.postgres
]
}