consul/testing/deployer/sprawl/internal/tfgen/templates/container-proxy.tf.tmpl

35 lines
791 B
Cheetah
Raw Normal View History

resource "docker_container" "{{.DockerNetworkName}}-forwardproxy" {
name = "{{.DockerNetworkName}}-forwardproxy"
image = docker_image.nginx.image_id
restart = "always"
dns = ["8.8.8.8"]
ports {
internal = {{.InternalPort}}
}
network_mode = "bridge"
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
}
}