mirror of https://github.com/hashicorp/consul
40 lines
841 B
Cheetah
40 lines
841 B
Cheetah
resource "docker_container" "{{.PodName}}" {
|
|
name = "{{.PodName}}"
|
|
image = docker_image.pause.image_id
|
|
hostname = "{{.PodName}}"
|
|
restart = "always"
|
|
dns = ["{{.DNSAddress}}"]
|
|
|
|
{{- range $k, $v := .Labels }}
|
|
labels {
|
|
label = "{{ $k }}"
|
|
value = "{{ $v }}"
|
|
}
|
|
{{- end }}
|
|
|
|
depends_on = [
|
|
docker_container.{{.DockerNetworkName}}-coredns,
|
|
docker_container.{{.DockerNetworkName}}-forwardproxy,
|
|
]
|
|
|
|
{{- range .Ports }}
|
|
ports {
|
|
internal = {{.}}
|
|
}
|
|
{{- end }}
|
|
|
|
network_mode = "bridge"
|
|
{{- range .Node.Addresses }}
|
|
networks_advanced {
|
|
name = docker_network.{{.DockerNetworkName}}.name
|
|
ipv4_address = "{{.IPAddress}}"
|
|
}
|
|
{{- end }}
|
|
}
|
|
|
|
output "ports_{{.Node.Cluster}}_{{.Node.Partition}}_{{.Node.Name}}" {
|
|
value = {
|
|
for port in docker_container.{{.PodName}}.ports : port.internal => port.external
|
|
}
|
|
}
|