Skip to content

Commit dfbe5ac

Browse files
authored
Merge pull request #3 from mutablelogic/dev
Added service parameters for coredns and openldap
2 parents 56ea102 + 9bbd8b0 commit dfbe5ac

File tree

14 files changed

+100
-26
lines changed

14 files changed

+100
-26
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ provider "nomad" {
2525
DNS server which could be used to resolve nomad services into dns records
2626

2727
* [Documentation](https://coredns.io/)
28-
* [Terraform Example](examples/coredns.tf)
28+
* [Terraform Example](_examples/coredns.tf)
2929
* [Nomad Job](coredns/nomad/coredns.hcl)
3030

3131
TODO:
@@ -36,7 +36,7 @@ TODO:
3636
grafana is a database server
3737

3838
* [Documentation](https://grafana.com/docs/grafana/latest/)
39-
* [Terraform Example](examples/grafana.tf)
39+
* [Terraform Example](_examples/grafana.tf)
4040
* [Nomad Job](grafana/nomad/grafana.hcl)
4141

4242
TODO:
@@ -50,7 +50,7 @@ TODO:
5050
Time-series database, which can be placed on several nodes
5151

5252
* [Documentation](https://docs.influxdata.com/influxdb/v2/)
53-
* [Terraform Example](examples/influxdb.tf)
53+
* [Terraform Example](_examples/influxdb.tf)
5454
* [Nomad Job](influxdb/nomad/influxdb.hcl)
5555

5656
TODO:
@@ -61,7 +61,7 @@ TODO:
6161
MQTT broker, which can be placed on several nodes
6262

6363
* [Documentation](https://mosquitto.org/)
64-
* [Terraform Example](examples/mosquitto.tf)
64+
* [Terraform Example](_examples/mosquitto.tf)
6565
* [Nomad Job](mosquitto/nomad/mosquitto.hcl)
6666

6767
TODO:
@@ -72,7 +72,7 @@ TODO:
7272
Web server and reverse proxy, which can be placed on several nodes
7373

7474
* [Documentation](https://nginx.org/en/)
75-
* [Terraform Example](examples/nginx.tf)
75+
* [Terraform Example](_examples/nginx.tf)
7676
* [Nomad Job](nginx/nomad/nginx.hcl)
7777

7878
TODO:
@@ -85,7 +85,7 @@ TODO:
8585
OpenLDAP server, which can be placed on several nodes
8686

8787
* [Documentation](https://www.openldap.org/)
88-
* [Terraform Example](examples/openldap.tf)
88+
* [Terraform Example](_examples/openldap.tf)
8989
* [Nomad Job](openldap/nomad/openldap.hcl)
9090

9191
TODO:
@@ -99,7 +99,7 @@ TODO:
9999
PostgreSQL is a database server
100100

101101
* [Documentation](https://www.postgresql.org/)
102-
* [Terraform Example](examples/postgresql.tf)
102+
* [Terraform Example](_examples/postgresql.tf)
103103
* [Nomad Job](postgresql/nomad/postgresql.hcl)
104104

105105
TODO:
@@ -110,7 +110,7 @@ TODO:
110110
Cluster filesystem, which can be spread across multiple nodes.
111111

112112
* [Documentation](https://github.com/seaweedfs/seaweedfs)
113-
* [Terraform Example](examples/seaweedfs.tf)
113+
* [Terraform Example](_examples/seaweedfs.tf)
114114
* [Nomad Job](seaweedfs/nomad/seaweedfs.hcl)
115115

116116
TODO:
@@ -122,7 +122,7 @@ TODO:
122122
Semaphore is a Ansible front-end
123123

124124
* [Documentation](https://www.semui.co/)
125-
* [Terraform Example](examples/semaphore.tf)
125+
* [Terraform Example](_examples/semaphore.tf)
126126
* [Nomad Job](semaphore/nomad/semaphore.hcl)
127127

128128
TODO:
@@ -134,7 +134,7 @@ TODO:
134134
Time-series metrics collector, which can be placed on several nodes
135135

136136
* [Documentation](https://docs.influxdata.com/telegraf/v1/)
137-
* [Terraform Example](examples/telegraf.tf)
137+
* [Terraform Example](_examples/telegraf.tf)
138138
* [Nomad Job](telegraf/nomad/telegraf.hcl)
139139

140140
When setting up your configuration with inputs and outputs, each value needs

_examples/influxdb.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// Example InfluxDB time-series database
33
module "influxdb" {
4-
source = "github.com/mutablelogic/tf-nomad/influxdb"
4+
source = "github.com/mutablelogic/tf-nomad//influxdb"
55

66
// Required parameters
77
dc = "datacenter" // Nomad datacenter for the cluster

_examples/mosquitto.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// Example MQTT broker, using the eclipse-mosquitto docker image
33
module "mqtt" {
4-
source = "github.com/mutablelogic/tf-nomad/mosquitto"
4+
source = "github.com/mutablelogic/tf-nomad//mosquitto"
55

66
// Required parameters
77
dc = "datacenter" // Nomad datacenter for the cluster

_examples/nginx.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// Example nginx reverse proxy module
33
module "nginx" {
4-
source = "github.com/mutablelogic/tf-nomad/nginx"
4+
source = "github.com/mutablelogic/tf-nomad//nginx"
55

66
// Required parameters
77
dc = "datacenter" // Nomad datacenter for the cluster

_examples/openldap.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// Example LDAP server, using the bitnami/openldap docker image
33
module "openldap" {
4-
source = "github.com/mutablelogic/tf-nomad/openldap"
4+
source = "github.com/mutablelogic/tf-nomad//openldap"
55

66
// Required parameters
77
dc = "datacenter" // Nomad datacenter for the cluster

_examples/postgresql.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
module "postgresql" {
3-
source = "github.com/mutablelogic/tf-nomad/postgresql"
3+
source = "github.com/mutablelogic/tf-nomad//postgresql"
44

55
// Required parameters
66
dc = local.datacenter // Nomad datacenter for the cluster

_examples/seaweedfs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// Example Cluster filesystem using seaweedfs, with one master, two volumes and three filers
33
module "clusterfs" {
4-
source = "github.com/mutablelogic/tf-nomad/seaweedfs"
4+
source = "github.com/mutablelogic/tf-nomad//seaweedfs"
55
enabled = true // If false, no-op
66
dc = "datacenter" // Nomad datacenter for the cluster
77
namespace = "clusterfs" // Nomad namespace for the cluster

_examples/telegraf.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// Example telegraf time-series metrics collector
33
module "telegraf" {
4-
source = "github.com/mutablelogic/tf-nomad/telegraf"
4+
source = "github.com/mutablelogic/tf-nomad//telegraf"
55

66
// Required parameters
77
dc = local.datacenter // Nomad datacenter for the cluster

coredns/input.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ variable "docker_tag" {
2222
default = "v1.11.1"
2323
}
2424

25+
variable "service_provider" {
26+
description = "Service provider, either consul or nomad"
27+
type = string
28+
default = "nomad"
29+
}
30+
31+
variable "service_name" {
32+
description = "Service name"
33+
type = string
34+
default = "coredns-dns"
35+
}
36+
37+
variable "service_dns" {
38+
description = "Service discovery DNS"
39+
type = list(string)
40+
default = []
41+
}
42+
2543
variable "hosts" {
2644
type = list(string)
2745
description = "List of hosts to deploy on. If empty, one allocation will be created"

coredns/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ resource "nomad_job" "coredns" {
1010
namespace = var.namespace
1111
docker_image = local.docker_image
1212
docker_always_pull = jsonencode(local.docker_always_pull)
13+
service_provider = var.service_provider
14+
service_name = var.service_name
15+
service_dns = jsonencode(var.service_dns)
1316
hosts = jsonencode(var.hosts)
1417
port = var.port
1518
corefile = file("${path.module}/config/Corefile")

0 commit comments

Comments
 (0)