aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/1n_nmd/minio/conf/nomad/mc.hcl
blob: 238003bb003e2b9dfc42c6da70ee80f733157a8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
job "${job_name}" {
  # The "region" parameter specifies the region in which to execute the job.
  # If omitted, this inherits the default region name of "global".
  # region = "global"
  #
  # The "datacenters" parameter specifies the list of datacenters which should
  # be considered when placing this task. This must be provided.
  datacenters = "${datacenters}"

  # The "type" parameter controls the type of job, which impacts the scheduler's
  # decision on placement. This configuration is optional and defaults to
  # "service". For a full list of job types and their differences, please see
  # the online documentation.
  #
  # For more information, please see the online documentation at:
  #
  #     https://www.nomadproject.io/docs/jobspec/schedulers.html
  #
  type        = "batch"

  # The "group" stanza defines a series of tasks that should be co-located on
  # the same Nomad client. Any task within a group will be placed on the same
  # client.
  #
  # For more information and examples on the "group" stanza, please see
  # the online documentation at:
  #
  #     https://www.nomadproject.io/docs/job-specification/group.html
  #
  group "prod-group1-mc" {
    task "prod-task1-create-buckets" {
      # The "driver" parameter specifies the task driver that should be used to
      # run the task.
      driver        = "docker"

      %{ if use_vault_provider }
      vault {
        policies    = "${vault_kv_policy_name}"
      }
     %{ endif }

      # The "config" stanza specifies the driver configuration, which is passed
      # directly to the driver to start the task. The details of configurations
      # are specific to each driver, so please see specific driver
      # documentation for more information.
      config {
        image       = "${image}"
        entrypoint  = [
          "/bin/sh",
          "-c",
          "${command}"
        ]
        dns_servers  = [ "$${attr.unique.network.ip-address}" ]
        privileged   = false
      }

      # The env stanza configures a list of environment variables to populate
      # the task's environment before starting.
      env {
        %{ if use_vault_provider }
        {{ with secret "${vault_kv_path}" }}
        MINIO_ACCESS_KEY = "{{ .Data.data.${vault_kv_field_access_key} }}"
        MINIO_SECRET_KEY = "{{ .Data.data.${vault_kv_field_secret_key} }}"
        {{ end }}
        %{ else }
        MINIO_ACCESS_KEY = "${access_key}"
        MINIO_SECRET_KEY = "${secret_key}"
        %{ endif }
        ${ envs }
      }
    }
  }
}