~damien/infrastructure

infrastructure/terraform/cluster/main.tf -rw-r--r-- 2.8 KiB
41e11f7d — Damien Radtke Use blue-green terraform strategy for cluster upgrades 3 months ago
                                                                                
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
variable linode_token { type = string }
variable ca_host { type = string }
variable ca_key { type = string }
variable vault_token { type = string }

variable region { type = string }
variable image { type = string }
variable instance_type { type = string }
variable authorized_users { type = list(string) }

variable consul_version { type = string }
variable nomad_version { type = string }
variable vault_version { type = string }

locals {
  stackscript_id   = 535217
}

module "consul-server" {
  source = "./consul-server"

  servers        = 1
  consul_version = var.consul_version

  datacenter       = var.region
  image            = var.image
  instance_type    = var.instance_type
  stackscript_id   = local.stackscript_id
  authorized_users = var.authorized_users
  ca_host          = var.ca_host
  ca_key           = var.ca_key
}

module "nomad-server" {
  source = "./nomad-server"

  servers           = 1
  consul_version    = var.consul_version
  nomad_version     = var.nomad_version
  consul_server_ips = module.consul-server.instances[*].ipv6

  datacenter       = var.region
  image            = var.image
  instance_type    = var.instance_type
  stackscript_id   = local.stackscript_id
  authorized_users = var.authorized_users
  ca_host          = var.ca_host
  ca_key           = var.ca_key
  vault_token      = var.vault_token
}

module "nomad-client" {
  source = "./nomad-client"

  clients           = 1
  consul_version    = var.consul_version
  nomad_version     = var.nomad_version
  consul_server_ips = module.consul-server.instances[*].ipv6

  datacenter       = var.region
  image            = var.image
  instance_type    = var.instance_type
  stackscript_id   = local.stackscript_id
  authorized_users = var.authorized_users
  ca_host          = var.ca_host
  ca_key           = var.ca_key
}

module "nomad-client-load-balancer" {
  source = "./nomad-client"

  clients           = 1
  consul_version    = var.consul_version
  nomad_version     = var.nomad_version
  node_class        = "load-balancer"
  consul_server_ips = module.consul-server.instances[*].ipv6

  datacenter       = var.region
  image            = var.image
  instance_type    = var.instance_type
  stackscript_id   = local.stackscript_id
  authorized_users = var.authorized_users
  ca_host          = var.ca_host
  ca_key           = var.ca_key
}

module "vault-server" {
  source = "./vault-server"

  servers           = 1
  consul_version    = var.consul_version
  vault_version     = var.vault_version
  consul_server_ips = module.consul-server.instances[*].ipv6

  datacenter       = var.region
  image            = var.image
  instance_type    = var.instance_type
  stackscript_id   = local.stackscript_id
  authorized_users = var.authorized_users
  ca_host          = var.ca_host
  ca_key           = var.ca_key
}