github.com/hernad/nomad@v1.6.112/e2e/terraform/nomad.tf (about)

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