resource "docker_container" "{{.DockerNetworkName}}-forwardproxy" { name = "{{.DockerNetworkName}}-forwardproxy" image = docker_image.nginx.latest restart = "always" dns = ["8.8.8.8"] ports { internal = {{.InternalPort}} } networks_advanced { name = docker_network.{{.DockerNetworkName}}.name ipv4_address = "{{.IPAddress}}" } env = [ {{- range .Env }} "{{.}}", {{- end}} ] volumes { host_path = abspath("nginx-config-{{.Name}}/nginx.conf") container_path = "/etc/nginx/conf.d/default.conf" read_only = true } } output "forwardproxyport_{{.Name}}" { value = { for port in docker_container.{{.DockerNetworkName}}-forwardproxy.ports : port.internal => port.external } }