github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/terraform/nomad.tf (about)

     1  module "nomad_server" {
     2    source     = "./provision-nomad"
     3    depends_on = [aws_instance.server]
     4    count      = var.server_count
     5  
     6    platform = "linux"
     7    arch     = "linux_amd64"
     8    role     = "server"
     9    index    = count.index
    10    instance = aws_instance.server[count.index]
    11  
    12    nomad_local_binary = count.index < length(var.nomad_local_binary_server) ? var.nomad_local_binary_server[count.index] : var.nomad_local_binary
    13  
    14    nomad_license = var.nomad_license
    15    tls_ca_key    = tls_private_key.ca.private_key_pem
    16    tls_ca_cert   = tls_self_signed_cert.ca.cert_pem
    17  
    18    connection = {
    19      type        = "ssh"
    20      user        = "ubuntu"
    21      port        = 22
    22      private_key = "${path.root}/keys/${local.random_name}.pem"
    23    }
    24  }
    25  
    26  # TODO: split out the different Linux targets (ubuntu, centos, arm, etc.) when
    27  # they're available
    28  module "nomad_client_ubuntu_jammy_amd64" {
    29    source     = "./provision-nomad"
    30    depends_on = [aws_instance.client_ubuntu_jammy_amd64]
    31    count      = var.client_count_ubuntu_jammy_amd64
    32  
    33    platform = "linux"
    34    arch     = "linux_amd64"
    35    role     = "client"
    36    index    = count.index
    37    instance = aws_instance.client_ubuntu_jammy_amd64[count.index]
    38  
    39    nomad_local_binary = count.index < length(var.nomad_local_binary_client_ubuntu_jammy_amd64) ? var.nomad_local_binary_client_ubuntu_jammy_amd64[count.index] : var.nomad_local_binary
    40  
    41    tls_ca_key  = tls_private_key.ca.private_key_pem
    42    tls_ca_cert = tls_self_signed_cert.ca.cert_pem
    43  
    44    connection = {
    45      type        = "ssh"
    46      user        = "ubuntu"
    47      port        = 22
    48      private_key = "${path.root}/keys/${local.random_name}.pem"
    49    }
    50  }
    51  
    52  
    53  # TODO: split out the different Windows targets (2016, 2019) when they're
    54  # available
    55  module "nomad_client_windows_2016_amd64" {
    56    source     = "./provision-nomad"
    57    depends_on = [aws_instance.client_windows_2016_amd64]
    58    count      = var.client_count_windows_2016_amd64
    59  
    60    platform = "windows"
    61    arch     = "windows_amd64"
    62    role     = "client"
    63    index    = count.index
    64    instance = aws_instance.client_windows_2016_amd64[count.index]
    65  
    66    nomad_local_binary = count.index < length(var.nomad_local_binary_client_windows_2016_amd64) ? var.nomad_local_binary_client_windows_2016_amd64[count.index] : ""
    67  
    68    tls_ca_key  = tls_private_key.ca.private_key_pem
    69    tls_ca_cert = tls_self_signed_cert.ca.cert_pem
    70  
    71    connection = {
    72      type        = "ssh"
    73      user        = "Administrator"
    74      port        = 22
    75      private_key = "${path.root}/keys/${local.random_name}.pem"
    76    }
    77  }