github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/e2e/terraform/nomad.tf (about)

     1  module "nomad_server" {
     2  
     3    source     = "./provision-nomad"
     4    depends_on = [aws_instance.server]
     5    count      = var.server_count
     6  
     7    platform = "linux_amd64"
     8    profile  = var.profile
     9    role     = "server"
    10    index    = count.index
    11  
    12    # The specific version of Nomad deployed will default to whichever one of
    13    # nomad_sha, nomad_version, or nomad_local_binary is set, but if you want to
    14    # deploy multiple versions you can use the nomad_*_server variables to
    15    # provide a list of builds
    16    nomad_version = count.index < length(var.nomad_version_server) ? var.nomad_version_server[count.index] : var.nomad_version
    17  
    18    nomad_sha = count.index < length(var.nomad_sha_server) ? var.nomad_sha_server[count.index] : var.nomad_sha
    19  
    20    nomad_local_binary = count.index < length(var.nomad_local_binary_server) ? var.nomad_local_binary_server[count.index] : var.nomad_local_binary
    21  
    22    nomad_enterprise = var.nomad_enterprise
    23    nomad_acls       = var.nomad_acls
    24    cluster_name     = local.random_name
    25  
    26    connection = {
    27      type        = "ssh"
    28      user        = "ubuntu"
    29      host        = aws_instance.server[count.index].public_ip
    30      port        = 22
    31      private_key = "${path.root}/keys/${local.random_name}.pem"
    32    }
    33  }
    34  
    35  # TODO: split out the different Linux targets (ubuntu, centos, arm, etc.) when
    36  # they're available
    37  module "nomad_client_ubuntu_bionic_amd64" {
    38  
    39    source     = "./provision-nomad"
    40    depends_on = [aws_instance.client_ubuntu_bionic_amd64]
    41    count      = var.client_count_ubuntu_bionic_amd64
    42  
    43    platform = "linux_amd64"
    44    profile  = var.profile
    45    role     = "client-linux"
    46    index    = count.index
    47  
    48    # The specific version of Nomad deployed will default to whichever one of
    49    # nomad_sha, nomad_version, or nomad_local_binary is set, but if you want to
    50    # deploy multiple versions you can use the nomad_*_client_linux
    51    # variables to provide a list of builds
    52    nomad_version = count.index < length(var.nomad_version_client_ubuntu_bionic_amd64) ? var.nomad_version_client_ubuntu_bionic_amd64[count.index] : var.nomad_version
    53  
    54    nomad_sha = count.index < length(var.nomad_sha_client_ubuntu_bionic_amd64) ? var.nomad_sha_client_ubuntu_bionic_amd64[count.index] : var.nomad_sha
    55  
    56    nomad_local_binary = count.index < length(var.nomad_local_binary_client_ubuntu_bionic_amd64) ? var.nomad_local_binary_client_ubuntu_bionic_amd64[count.index] : var.nomad_local_binary
    57  
    58    nomad_enterprise = var.nomad_enterprise
    59    nomad_acls       = false
    60    cluster_name     = local.random_name
    61  
    62    connection = {
    63      type        = "ssh"
    64      user        = "ubuntu"
    65      host        = aws_instance.client_ubuntu_bionic_amd64[count.index].public_ip
    66      port        = 22
    67      private_key = "${path.root}/keys/${local.random_name}.pem"
    68    }
    69  }
    70  
    71  # TODO: split out the different Windows targets (2016, 2019) when they're
    72  # available
    73  module "nomad_client_windows_2016_amd64" {
    74  
    75    source     = "./provision-nomad"
    76    depends_on = [aws_instance.client_windows_2016_amd64]
    77    count      = var.client_count_windows_2016_amd64
    78  
    79    platform = "windows_amd64"
    80    profile  = var.profile
    81    role     = "client-windows"
    82    index    = count.index
    83  
    84    # The specific version of Nomad deployed will default to whichever one of
    85    # nomad_sha, nomad_version, or nomad_local_binary is set, but if you want to
    86    # deploy multiple versions you can use the nomad_*_client_windows
    87    # variables to provide a list of builds
    88    nomad_version = count.index < length(var.nomad_version_client_windows_2016_amd64) ? var.nomad_version_client_windows_2016_amd64[count.index] : var.nomad_version
    89  
    90    nomad_sha = count.index < length(var.nomad_sha_client_windows_2016_amd64) ? var.nomad_sha_client_windows_2016_amd64[count.index] : var.nomad_sha
    91  
    92    # if nomad_local_binary is in use, you must pass a nomad_local_binary_client_windows_2016_amd64!
    93    nomad_local_binary = count.index < length(var.nomad_local_binary_client_windows_2016_amd64) ? var.nomad_local_binary_client_windows_2016_amd64[count.index] : ""
    94  
    95    nomad_enterprise = var.nomad_enterprise
    96    nomad_acls       = false
    97    cluster_name     = local.random_name
    98  
    99  
   100    connection = {
   101      type        = "ssh"
   102      user        = "Administrator"
   103      host        = aws_instance.client_windows_2016_amd64[count.index].public_ip
   104      port        = 22
   105      private_key = "${path.root}/keys/${local.random_name}.pem"
   106    }
   107  }