diff options
author | pmikus <pmikus@cisco.com> | 2021-03-07 08:57:13 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2021-03-11 07:07:03 +0000 |
commit | c318223fcd266c0ee2982e803c44e193c2023054 (patch) | |
tree | 4559bf49a5ab183d0c3a75a883edf40e7802222f /fdio.infra.terraform/1n_nmd/minio/main.tf | |
parent | 221e2f4da7cb27954525d973d930cb8db4601c8f (diff) |
Infra: Switch csit-shim to fdiotools
+ use /u/fdiotools
+ use ubuntu 20.04
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: I091e63a0d9e50de203b1527c7500b3864a616af6
Diffstat (limited to 'fdio.infra.terraform/1n_nmd/minio/main.tf')
-rw-r--r-- | fdio.infra.terraform/1n_nmd/minio/main.tf | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/fdio.infra.terraform/1n_nmd/minio/main.tf b/fdio.infra.terraform/1n_nmd/minio/main.tf new file mode 100644 index 0000000000..62d143f4b1 --- /dev/null +++ b/fdio.infra.terraform/1n_nmd/minio/main.tf @@ -0,0 +1,82 @@ +locals { + datacenters = join(",", var.nomad_datacenters) + minio_env_vars = join("\n", + concat([ + ], var.minio_envs) + ) + mc_env_vars = join("\n", + concat([ + ], var.mc_envs) + ) + mc_formatted_bucket_list = formatlist("LOCALMINIO/%s", var.minio_buckets) + mc_add_config_command = concat( + [ + "mc", + "config", + "host", + "add", + "LOCALMINIO", + "http://${var.minio_service_name}.service.consul:${var.minio_port}", + "$MINIO_ACCESS_KEY", + "$MINIO_SECRET_KEY", + ]) + mc_create_bucket_command = concat(["mc", "mb", "-p"], local.mc_formatted_bucket_list) + command = join(" ", concat(local.mc_add_config_command, ["&&"], local.mc_create_bucket_command, [";"], concat(var.mc_extra_commands))) +} + +data "template_file" "nomad_job_minio" { + template = file("${path.module}/conf/nomad/minio.hcl") + vars = { + job_name = var.minio_job_name + datacenters = local.datacenters + use_canary = var.minio_use_canary + group_count = var.minio_group_count + use_host_volume = var.minio_use_host_volume + host_volume = var.nomad_host_volume + service_name = var.minio_service_name + host = var.minio_host + port = var.minio_port + upstreams = jsonencode(var.minio_upstreams) + cpu_proxy = var.minio_resource_proxy.cpu + memory_proxy = var.minio_resource_proxy.memory + use_vault_provider = var.minio_vault_secret.use_vault_provider + image = var.minio_container_image + access_key = var.minio_access_key + secret_key = var.minio_secret_key + data_dir = var.minio_data_dir + envs = local.minio_env_vars + cpu = var.minio_cpu + memory = var.minio_memory + } +} + +data "template_file" "nomad_job_mc" { + template = file("${path.module}/conf/nomad/mc.hcl") + vars = { + job_name = var.mc_job_name + service_name = var.mc_service_name + datacenters = local.datacenters + minio_service_name = var.minio_service_name + minio_port = var.minio_port + image = var.mc_container_image + access_key = var.minio_access_key + secret_key = var.minio_secret_key + use_vault_provider = var.minio_vault_secret.use_vault_provider + envs = local.mc_env_vars + command = local.command + } +} + +resource "nomad_job" "nomad_job_minio" { + jobspec = data.template_file.nomad_job_minio.rendered + detach = false +} + +#resource "nomad_job" "nomad_job_mc" { +# jobspec = data.template_file.nomad_job_mc.rendered +# detach = false +# +# depends_on = [ +# nomad_job.nomad_job_minio +# ] +#}
\ No newline at end of file |