forked from Skatteetaten/terraform-nomad-trino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
121 lines (100 loc) · 3.64 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
locals {
nomad_namespace = "default"
nomad_datacenters = ["dc1"]
}
module "presto" {
depends_on = [
module.minio,
module.hive
]
source = "../."
nomad_job_name = "presto"
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
service_name = "presto"
port = 8080
docker_image = "prestosql/presto:333"
#hivemetastore
hivemetastore = {
service_name = module.hive.service_name
port = 9083 # todo: add output var
}
# minio
minio = {
service_name = module.minio.minio_service_name
port = 9000 # todo: add output var
access_key = module.minio.minio_access_key
secret_key = module.minio.minio_secret_key
}
}
module "minio" {
source = "github.com/fredrikhgrelland/terraform-nomad-minio.git?ref=0.0.3"
# nomad
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
# minio
service_name = "minio"
host = "127.0.0.1"
port = 9000
container_image = "minio/minio:latest" # todo: avoid using tag latest in future releases
access_key = "minio"
secret_key = "minio123"
buckets = ["default", "hive"]
container_environment_variables = ["JUST_EXAMPLE_VAR1=some-value", "ANOTHER_EXAMPLE2=some-other-value"]
# 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/fredrikhgrelland/terraform-nomad-postgres.git?ref=0.0.1"
# nomad
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
# postgres
postgres_service_name = "postgres"
postgres_container_image = "postgres:12-alpine"
postgres_container_port = 5432
postgres_admin_user = "hive"
postgres_admin_password = "hive"
postgres_database = "metastore"
postgres_container_environment_variables = ["PGDATA=/var/lib/postgresql/data"]
}
module "hive" {
source = "github.com/fredrikhgrelland/terraform-nomad-hive.git?ref=0.0.2"
# nomad
nomad_datacenters = local.nomad_datacenters
nomad_namespace = local.nomad_namespace
nomad_job_switch_local = false
# hive
hive_service_name = "hive-metastore"
hive_container_port = 9083
// support CSV -> https://towardsdatascience.com/load-and-query-csv-file-in-s3-with-presto-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 = 9000, # todo: minio 0.0.1 does not have output variable 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
]
}