Pihole and Dnscrypt Proxy Setup is done
Diff
.terraform-version | 2 +-
dnscrypt-proxy.tf | 24 ++++++++++++++++++++++--
pihole.tf | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
modules/container/main.tf | 2 ++
modules/container/vars.tf | 6 ++++++
5 files changed, 81 insertions(+), 51 deletions(-)
@@ -1,1 +1,1 @@
0.11.12-beta1
0.11.12
@@ -1,15 +1,29 @@
module "dnscrypt" {
name = "dnscrypt-proxy"
source = "modules/container"
image = "mattbodholdt/dnscrypt-proxy"
ports = [{
internal = "53"
external = "553"
ip = "192.168.1.111"
protocol = "udp"
restart = "always"
networks_advanced = [{
name = "dns"
aliases = ["dnscrypt", "dnscrypt-proxy"]
ipv4_address = "172.30.0.2"
}]
dns = ["127.0.0.1"]
}
resource "docker_network" "dns" {
name = "dns"
internal = false
ipam_config {
subnet = "172.30.0.0/29"
gateway = "172.30.0.1"
}
}
@@ -1,46 +1,54 @@
module "pihole" {
name = "pihole"
source = "modules/container"
web {
expose = true
port = "80"
host = "dns.in.${var.root-domain}"
}
restart = "always"
image = "pihole/pihole"
ports = [{
internal = "53"
external = "53"
ip = "192.168.1.111"
protocol = "udp"
}]
env = [
"ServerIP=192.168.1.111",
"WEBPASSWORD=${var.pihole_password}",
"DNS1=172.30.0.2",
"DNS2=no",
"VIRTUAL_HOST=dns.in.${var.root-domain}",
]
volumes = [
{
host_path = "/mnt/xwing/config/pihole"
container_path = "/etc/pihole"
},
{
host_path = "/mnt/xwing/config/pihole-dnsmasq.d"
container_path = "/etc/dnsmasq.d"
},
]
networks_advanced = [{
name = "dns"
},
{
name = "traefik"
},
]
capabilities = [{
add = ["NET_ADMIN"]
}]
dns = ["127.0.0.1", "9.9.9.9", "1.1.1.1"]
}
@@ -29,6 +29,8 @@
networks = ["${concat(var.networks,compact(split(",",lookup(var.web, "expose", "false") == "false" ? "" :"${data.docker_network.traefik.id}")))}"]
networks_advanced = ["${var.networks_advanced}"]
memory = "${local.resource["memory"]}"
memory_swap = "${local.resource["memory_swap"]}"
@@ -12,6 +12,12 @@
default = []
}
variable "networks_advanced" {
description = "list of networks_advanced"
type = "list"
default = []
}
variable "networks" {
description = "list of networks"
type = "list"