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 }}
|
|
|
|
|
|
|
|
{{- 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
|
|
|
|
}
|
|
|
|
}
|