2023-07-17 22:15:22 +00:00
|
|
|
resource "docker_container" "{{.PodName}}" {
|
|
|
|
name = "{{.PodName}}"
|
2023-11-02 19:25:48 +00:00
|
|
|
image = docker_image.pause.image_id
|
2023-07-17 22:15:22 +00:00
|
|
|
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 }}
|
|
|
|
|
2024-05-03 20:21:43 +00:00
|
|
|
network_mode = "bridge"
|
2023-07-17 22:15:22 +00:00
|
|
|
{{- 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
|
|
|
|
}
|
|
|
|
}
|