diff --git a/terranix/containers/gateway-mesh/default.nix b/terranix/containers/gateway-mesh/default.nix new file mode 100644 index 0000000..e4fa385 --- /dev/null +++ b/terranix/containers/gateway-mesh/default.nix @@ -0,0 +1,16 @@ +{ elib, ... }: +let + inherit (elib) + nomadJob; +in +{ + resource."nomad_job"."mesh" = nomadJob { + jobspec = ./job.hcl; + vars = { + "datacenters" = builtins.toJSON [ + "do-1" + "homelab-1" + ]; + }; + }; +} diff --git a/terranix/containers/gateway-mesh/job.hcl b/terranix/containers/gateway-mesh/job.hcl new file mode 100644 index 0000000..1c75102 --- /dev/null +++ b/terranix/containers/gateway-mesh/job.hcl @@ -0,0 +1,30 @@ +variable "datacenters" { + type = list(string) +} + +job "gateway-mesh" { + datacenters = var.datacenters + + group "envoy" { + network { + mode = "bridge" + + port "mesh_wan" { + host_network = "mesh" + } + } + + service { + name = "mesh-gateway" + + port = "mesh_wan" + + connect { + gateway { + mesh {} + proxy {} + } + } + } + } +}