aboutsummaryrefslogtreecommitdiffstats
path: root/terraform-ci-infra/1n_nmd/nginx
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-03-05 11:48:19 +0000
committerPeter Mikus <pmikus@cisco.com>2021-03-05 19:48:00 +0000
commitf7825e80ea0688fa337b8a36086df2e577ca6101 (patch)
tree70e1f7171df74a8d6b4f8bf677acf3af9d755a3a /terraform-ci-infra/1n_nmd/nginx
parentb83a029d3c6524b7f0139746fcc4325e692976b6 (diff)
Infra: Move nginx service closer to storage
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I3bbaa6c458e7994e964f7a07f69f9dab008a48fd
Diffstat (limited to 'terraform-ci-infra/1n_nmd/nginx')
-rw-r--r--terraform-ci-infra/1n_nmd/nginx/conf/nomad/nginx.hcl9
-rw-r--r--terraform-ci-infra/1n_nmd/nginx/main.tf6
-rw-r--r--terraform-ci-infra/1n_nmd/nginx/variables.tf12
3 files changed, 25 insertions, 2 deletions
diff --git a/terraform-ci-infra/1n_nmd/nginx/conf/nomad/nginx.hcl b/terraform-ci-infra/1n_nmd/nginx/conf/nomad/nginx.hcl
index 9cb5f8ef45..3c4761c567 100644
--- a/terraform-ci-infra/1n_nmd/nginx/conf/nomad/nginx.hcl
+++ b/terraform-ci-infra/1n_nmd/nginx/conf/nomad/nginx.hcl
@@ -87,6 +87,15 @@ job "${job_name}" {
# to 1.
count = 1
+ # https://www.nomadproject.io/docs/job-specification/volume
+ %{ if use_host_volume }
+ volume "prod-volume1-nginx" {
+ type = "host"
+ read_only = false
+ source = "${host_volume}"
+ }
+ %{ endif }
+
# The restart stanza configures a tasks's behavior on task failure. Restarts
# happen on the client that is running the task.
restart {
diff --git a/terraform-ci-infra/1n_nmd/nginx/main.tf b/terraform-ci-infra/1n_nmd/nginx/main.tf
index 96696922ff..025fcb6b8b 100644
--- a/terraform-ci-infra/1n_nmd/nginx/main.tf
+++ b/terraform-ci-infra/1n_nmd/nginx/main.tf
@@ -5,8 +5,10 @@ locals {
data "template_file" "nomad_job_nginx" {
template = file("${path.module}/conf/nomad/nginx.hcl")
vars = {
- job_name = var.nginx_job_name
- datacenters = local.datacenters
+ job_name = var.nginx_job_name
+ datacenters = local.datacenters
+ use_host_volume = var.nginx_use_host_volume
+ host_volume = var.nomad_host_volume
}
}
diff --git a/terraform-ci-infra/1n_nmd/nginx/variables.tf b/terraform-ci-infra/1n_nmd/nginx/variables.tf
index 1a1e45f89f..0262014049 100644
--- a/terraform-ci-infra/1n_nmd/nginx/variables.tf
+++ b/terraform-ci-infra/1n_nmd/nginx/variables.tf
@@ -5,9 +5,21 @@ variable "nomad_datacenters" {
default = [ "dc1" ]
}
+variable "nomad_host_volume" {
+ description = "Nomad Host Volume"
+ type = string
+ default = "persistence"
+}
+
# Nginx
variable "nginx_job_name" {
description = "Nginx job name"
type = string
default = "nginx"
+}
+
+variable "nginx_use_host_volume" {
+ description = "Use Nomad host volume feature"
+ type = bool
+ default = false
} \ No newline at end of file