~damien/infrastructure

0adacebcad9b90506d8fa794ef9d1f0c9dc9ed4a — Damien Radtke 2 years ago 4b88a55
Remove cluster module
15 files changed, 83 insertions(+), 109 deletions(-)

D terraform/cluster/main.tf
D terraform/cluster/outputs.tf
R terraform/{cluster/consul-server/main.tf => consul-server/main.tf}
R terraform/{cluster/consul-server/outputs.tf => consul-server/outputs.tf}
R terraform/{cluster/consul-server/variables.tf => consul-server/variables.tf}
M terraform/main.tf
R terraform/{cluster/nomad-client/main.tf => nomad-client/main.tf}
R terraform/{cluster/nomad-client/outputs.tf => nomad-client/outputs.tf}
R terraform/{cluster/nomad-client/variables.tf => nomad-client/variables.tf}
R terraform/{cluster/nomad-server/main.tf => nomad-server/main.tf}
R terraform/{cluster/nomad-server/outputs.tf => nomad-server/outputs.tf}
R terraform/{cluster/nomad-server/variables.tf => nomad-server/variables.tf}
R terraform/{cluster/vault-server/main.tf => vault-server/main.tf}
R terraform/{cluster/vault-server/outputs.tf => vault-server/outputs.tf}
R terraform/{cluster/vault-server/variables.tf => vault-server/variables.tf}
D terraform/cluster/main.tf => terraform/cluster/main.tf +0 -73
@@ 1,73 0,0 @@
// variable linode_token { type = string }
variable vault_token { type = string }

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

variable bootstrap { type = bool }

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

  servers        = 1

  datacenter       = var.datacenter
  image            = var.image
  instance_type    = var.instance_type
  authorized_users = var.authorized_users
  bootstrap        = var.bootstrap
}

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

  servers           = 1
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = var.datacenter
  image            = var.image
  instance_type    = var.instance_type
  authorized_users = var.authorized_users
  vault_token      = var.vault_token
  bootstrap        = var.bootstrap
}

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

  clients           = 1
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = var.datacenter
  image            = var.image
  instance_type    = var.instance_type
  authorized_users = var.authorized_users
}

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

  clients           = 1
  node_class        = "load-balancer"
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = var.datacenter
  image            = var.image
  instance_type    = var.instance_type
  authorized_users = var.authorized_users
}

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

  servers           = 1
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = var.datacenter
  image            = var.image
  instance_type    = var.instance_type
  authorized_users = var.authorized_users
  bootstrap        = var.bootstrap
}

D terraform/cluster/outputs.tf => terraform/cluster/outputs.tf +0 -20
@@ 1,20 0,0 @@
output "consul-servers" {
  description = "Consul servers"
  value       = module.consul-server.instances
}

output "nomad-servers" {
  description = "Nomad servers"
  value       = module.nomad-server.instances
}

// TODO: group by class
output "nomad-clients" {
  description = "Nomad clients"
  value       = module.nomad-client.instances
}

output "vault-servers" {
  description = "Vault servers"
  value       = module.vault-server.instances
}

R terraform/cluster/consul-server/main.tf => terraform/consul-server/main.tf +0 -0
R terraform/cluster/consul-server/outputs.tf => terraform/consul-server/outputs.tf +0 -0
R terraform/cluster/consul-server/variables.tf => terraform/consul-server/variables.tf +0 -0
M terraform/main.tf => terraform/main.tf +83 -16
@@ 7,6 7,18 @@ terraform {
  }
}

locals {
  datacenter       = "ca-central"
  image            = "private/13315378"
  // image            = "private/14625896"
  authorized_users = [data.linode_profile.me.username]
  instance_type    = "g6-nanode-1"
}

provider "linode" {
  token = var.linode_token
}

variable "linode_token" { type = string }
variable "bootstrap" {
  type = string


@@ 17,35 29,90 @@ variable "vault_token" {
  default = ""
}

provider "linode" {
  token = var.linode_token
}

data "linode_profile" "me" {}

module "cluster" {
  source           = "./cluster"
  datacenter       = "ca-central"
  image            = "private/13315378"
  // image            = "private/14625896"
  authorized_users = [data.linode_profile.me.username]
  instance_type    = "g6-nanode-1"
  vault_token      = var.vault_token
module "consul-server" {
  source = "./consul-server"

  servers        = 1

  datacenter       = local.datacenter
  image            = local.image
  instance_type    = local.instance_type
  authorized_users = local.authorized_users
  bootstrap        = var.bootstrap
}

output "consul-servers" {
  value = module.cluster.consul-servers
  description = "Consul servers"
  value       = module.consul-server.instances
}

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

  servers           = 1
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = local.datacenter
  image            = local.image
  instance_type    = local.instance_type
  authorized_users = local.authorized_users
  vault_token      = var.vault_token
  bootstrap        = var.bootstrap
}

output "nomad-servers" {
  value = module.cluster.nomad-servers
  description = "Nomad servers"
  value       = module.nomad-server.instances
}

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

  clients           = 1
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = local.datacenter
  image            = local.image
  instance_type    = local.instance_type
  authorized_users = local.authorized_users
}

// TODO: group by class

output "nomad-clients" {
  value = module.cluster.nomad-clients
  description = "Nomad clients"
  value       = module.nomad-client.instances
}

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

  clients           = 1
  node_class        = "load-balancer"
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = local.datacenter
  image            = local.image
  instance_type    = local.instance_type
  authorized_users = local.authorized_users
}

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

  servers           = 1
  consul_server_ips = module.consul-server.instances[*].ip

  datacenter       = local.datacenter
  image            = local.image
  instance_type    = local.instance_type
  authorized_users = local.authorized_users
  bootstrap        = var.bootstrap
}

output "vault-servers" {
  value = module.cluster.vault-servers
  description = "Vault servers"
  value       = module.vault-server.instances
}

R terraform/cluster/nomad-client/main.tf => terraform/nomad-client/main.tf +0 -0
R terraform/cluster/nomad-client/outputs.tf => terraform/nomad-client/outputs.tf +0 -0
R terraform/cluster/nomad-client/variables.tf => terraform/nomad-client/variables.tf +0 -0
R terraform/cluster/nomad-server/main.tf => terraform/nomad-server/main.tf +0 -0
R terraform/cluster/nomad-server/outputs.tf => terraform/nomad-server/outputs.tf +0 -0
R terraform/cluster/nomad-server/variables.tf => terraform/nomad-server/variables.tf +0 -0
R terraform/cluster/vault-server/main.tf => terraform/vault-server/main.tf +0 -0
R terraform/cluster/vault-server/outputs.tf => terraform/vault-server/outputs.tf +0 -0
R terraform/cluster/vault-server/variables.tf => terraform/vault-server/variables.tf +0 -0