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

38 lines
718 B
Cheetah

resource "docker_container" "{{.Node.DockerName}}" {
name = "{{.Node.DockerName}}"
network_mode = "container:${docker_container.{{.PodName}}.id}"
image = docker_image.{{.ImageResource}}.image_id
restart = "always"
env = [
"CONSUL_UID=0",
"CONSUL_GID=0",
"CONSUL_LICENSE={{.EnterpriseLicense}}",
]
{{- range $k, $v := .Labels }}
labels {
label = "{{ $k }}"
value = "{{ $v }}"
}
{{- end }}
command = [
"agent",
"-hcl",
<<-EOT
{{ .HCL }}
EOT
]
volumes {
volume_name = "{{.Node.DockerName}}"
container_path = "/consul/data"
}
volumes {
volume_name = "{{.TLSVolumeName}}"
container_path = "/consul/config/certs"
}
}