aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/terraform-nomad-pyspark-etl/main.tf
blob: cd6a9a52ff9fbda920e25df8958e533f2405ec28 (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
locals {
  datacenters = join(",", var.datacenters)
  envs        = join("\n", concat([], var.envs))
}

resource "nomad_job" "nomad_job" {
  jobspec = templatefile(
    "${path.module}/conf/nomad/${var.job_name}.hcl.tftpl",
    {
      aws_access_key_id         = var.aws_access_key_id,
      aws_secret_access_key     = var.aws_secret_access_key,
      aws_default_region        = var.aws_default_region
      cpu                       = var.cpu,
      cron                      = var.cron,
      datacenters               = local.datacenters,
      envs                      = local.envs,
      image                     = var.image,
      job_name                  = var.job_name,
      memory                    = var.memory,
      out_aws_access_key_id     = var.out_aws_access_key_id,
      out_aws_secret_access_key = var.out_aws_secret_access_key,
      out_aws_default_region    = var.out_aws_default_region
      prohibit_overlap          = var.prohibit_overlap,
      time_zone                 = var.time_zone,
      type                      = var.type,
      use_vault_provider        = var.vault_secret.use_vault_provider,
      vault_kv_policy_name      = var.vault_secret.vault_kv_policy_name,
      vault_kv_path             = var.vault_secret.vault_kv_path,
      vault_kv_field_access_key = var.vault_secret.vault_kv_field_access_key,
      vault_kv_field_secret_key = var.vault_secret.vault_kv_field_secret_key
  })
  detach = false
}