-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
73 lines (63 loc) · 2.62 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
# ---------------------------------------------------------------------------------------------------------------------
# DEPLOY NS1 ON A SINGLE DOCKER HOST
# This configuration is not recomended for production.
# ---------------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------
# REQUIRE A SPECIFIC TERRAFORM VERSION OR HIGHER
# This module has been updated with 0.12 syntax, which means it is no longer compatible with any versions below 0.12.
# ----------------------------------------------------------------------------------------------------------------------
terraform {
required_version = ">= 0.12"
}
# ----------------------------------------------------------------------------------------------------------------------
# DEPLOY DEDICATED NETWORK ON DOCKER HOST
# A dedicated Docker network should be deployed for the NS1 containers to join.
# -----------------------------------------------------------------------------------------------------------------------
provider "docker" {
host = var.docker_host
}
resource "docker_network" "host" {
name = "ns1"
driver = "bridge"
ipam_driver = "default"
attachable = true
ipam_config {
subnet = "172.18.12.0/24"
}
}
# ---------------------------------------------------------------------------------------------------------------------
# DEPLOY THE NS1 CONTAINERS
# This configuration assumes the containers have already been loaded on the Docker host.
# If they have not been loaded, it will attempt to download them from Docker Hub and fail.
# ---------------------------------------------------------------------------------------------------------------------
module "data" {
source = "../../modules/data"
docker_host = var.docker_host
docker_network = docker_network.host.name
}
module "core" {
source = "../../modules/core"
docker_host = var.docker_host
docker_network = docker_network.host.name
bootstrappable = true
}
module "xfr" {
source = "../../modules/xfr"
docker_host = var.docker_host
docker_network = docker_network.host.name
}
module "dns" {
source = "../../modules/dns"
docker_host = var.docker_host
docker_network = docker_network.host.name
}
module "dhcp" {
source = "../../modules/dhcp"
docker_host = var.docker_host
docker_network = docker_network.host.name
}
module "dist" {
source = "../../modules/dist"
docker_host = var.docker_host
docker_network = docker_network.host.name
}