-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
87 lines (76 loc) · 2.22 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
terraform {
required_providers {
vultr = {
source = "vultr/vultr"
version = "2.15.1"
}
}
}
variable "is_production" {
type = bool
default = false
}
variable "ssh_key_ids" {
type = list(string)
}
variable "region" {
type = string
}
variable "production_instances_plan" {
type = string
}
variable "test_instances_plan" {
type = string
}
locals {
environment = var.is_production ? "prod" : "test"
openfaas_instance_plan = var.is_production ? var.production_instances_plan : var.test_instances_plan
redis_instance_plan = var.is_production ? var.production_instances_plan : var.test_instances_plan
instance_plan = var.is_production ? var.production_instances_plan : var.test_instances_plan
das_apt_repository_instance_plan = var.test_instances_plan
instance_user_data = {
redis_stack_version = "7.2.0-v8"
redis_port = 29100
mongo_version = "7.0.5"
mongo_port = 28100
user_name = "dasadmin"
}
}
data "template_file" "mongodb_user_data" {
template = file("install-server.sh")
vars = merge(local.instance_user_data, {
environment_type = "toolbox"
redis_nodes = join(" ", [])
redis_node_len = 0
})
}
module "mongodb_instance" {
source = "./instance"
create_resource = false
name = "biodas1-mongodb"
environment = local.environment
user_data_file = data.template_file.mongodb_user_data.rendered
ssh_key_ids = var.ssh_key_ids
region = var.region
plan = local.instance_plan
}
module "das_apt_repository" {
source = "./instance"
create_resource = true
name = "das-apt-repository"
environment = local.environment
user_data_file = file("install-apt-repository.sh")
ssh_key_ids = var.ssh_key_ids
region = var.region
plan = "vc2-1c-2gb"
}
module "das_github_runner" {
source = "./instance"
create_resource = true
name = "das-github-runner"
environment = local.environment
user_data_file = file("github-runner.sh")
ssh_key_ids = var.ssh_key_ids
region = var.region
plan = "vc2-1c-2gb"
}