-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
79 lines (64 loc) · 1.55 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
variable "kubernetes_namespace" {
default = "minecraft-server"
description = "The namespace to deploy the server to"
}
locals {
labels = {
name = "minecraft-server",
}
}
resource "kubernetes_namespace" "i" {
metadata {
name = var.kubernetes_namespace
labels = local.labels
}
}
variable "mods" {
default = []
description = "The mods to install"
}
variable "additional_ports" {
default = []
description = "Additional ports to expose"
}
variable "environment_vars" {
default = {}
description = "Environment variables to set"
}
variable "use_database" {
default = false
description = "Whether to use a database"
}
variable "database_password" {
default = "password"
description = "The password for the database"
}
variable external_ip {
description = "The external IP address of the server"
}
module "base" {
source = "./modules/server"
namespace = var.kubernetes_namespace
# Connection details
external_ip = var.external_ip
# Server Configurations
environment_vars = merge({
MODS = join(" ", var.mods)
}, var.environment_vars)
additional_ports = var.additional_ports
# Database Configurations
use_database = var.use_database
database_config = {
POSTGRES_PASSWORD = var.database_password
}
}
variable domain {
description = "The domain to use for the server"
}
module bluemaps {
depends_on = [module.base]
source = "./modules/bluemaps"
domain = var.domain
persistent_volume_name = module.base.persistent_volume_name
namespace = var.kubernetes_namespace
}