github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/terraform/provisioning.tf (about)

     1  # outputs used for E2E testing and provisioning
     2  
     3  output "environment" {
     4    description = "get connection config by running: $(terraform output environment)"
     5    value       = <<EOM
     6  export NOMAD_ADDR=http://${aws_instance.server[0].public_ip}:4646
     7  export CONSUL_HTTP_ADDR=http://${aws_instance.server[0].public_ip}:8500
     8  export NOMAD_E2E=1
     9  EOM
    10  }
    11  
    12  output "provisioning" {
    13    description = "output to a file to be use w/ E2E framework -provision.terraform"
    14    value = jsonencode(
    15      {
    16        "servers" : [for server in aws_instance.server.* :
    17          {
    18            "runner" : {
    19              "key" : abspath(module.keys.private_key_filepath),
    20              "user" : "ubuntu",
    21              "host" : "${server.public_ip}",
    22              "port" : 22
    23            },
    24            "deployment" : {
    25              "nomad_sha" : var.nomad_sha,
    26              "platform" : "linux_amd64",
    27              "remote_binary_path" : "/usr/local/bin/nomad",
    28              "bundles" : [
    29                {
    30                  "source" : abspath("./shared"),
    31                  "destination" : "/ops/shared"
    32                }
    33              ],
    34              "steps" : [
    35                "sudo chmod +x /ops/shared/config/provision-server.sh",
    36                "sudo /ops/shared/config/provision-server.sh aws ${var.server_count} 'indexed/server-${index(aws_instance.server, server)}.hcl'"
    37              ],
    38            }
    39          }
    40        ],
    41        "clients" : concat([for client in aws_instance.client_linux.* :
    42          {
    43            "runner" : {
    44              "key" : abspath(module.keys.private_key_filepath),
    45              "user" : "ubuntu",
    46              "host" : "${client.public_ip}",
    47              "port" : 22
    48            },
    49            "deployment" : {
    50              "nomad_sha" : var.nomad_sha,
    51              "platform" : "linux_amd64",
    52              "remote_binary_path" : "/usr/local/bin/nomad",
    53              "bundles" : [
    54                {
    55                  "source" : abspath("./shared"),
    56                  "destination" : "/ops/shared"
    57                }
    58              ],
    59              "steps" : [
    60                "sudo chmod +x /ops/shared/config/provision-client.sh",
    61                "sudo /ops/shared/config/provision-client.sh aws 'indexed/client-${index(aws_instance.client_linux, client)}.hcl'"
    62              ],
    63            }
    64          }
    65          ],
    66          [for client in aws_instance.client_windows.* :
    67            {
    68              "runner" : {
    69                "key" : abspath(module.keys.private_key_filepath),
    70                "user" : "Administrator",
    71                "host" : "${client.public_ip}",
    72                "port" : 22
    73              },
    74              "deployment" : {
    75                "nomad_sha" : var.nomad_sha,
    76                "platform" : "windows_amd64",
    77                # need to use the / here for golang filepath handling to work
    78                # on the Unix test runner environment
    79                "remote_binary_path" : "C:/opt/nomad.exe",
    80                "bundles" : [
    81                  {
    82                    "source" : abspath("./shared"),
    83                    "destination" : "C:/ops/shared"
    84                  }
    85                ],
    86                "steps" : [
    87                  "& C:\\ops\\shared\\config\\provision-windows-client.ps1 -Cloud aws -Index 1"
    88                ]
    89              }
    90            }
    91        ])
    92    })
    93  }