github.com/bigcommerce/nomad@v0.9.3-bc/terraform/aws/env/us-east/main.tf (about) 1 variable "name" { 2 description = "Used to name various infrastructure components" 3 } 4 5 variable "whitelist_ip" { 6 description = "IP to whitelist for the security groups (set 0.0.0.0/0 for world)" 7 } 8 9 variable "region" { 10 description = "The AWS region to deploy to." 11 default = "us-east-1" 12 } 13 14 variable "ami" {} 15 16 variable "server_instance_type" { 17 description = "The AWS instance type to use for servers." 18 default = "t2.medium" 19 } 20 21 variable "client_instance_type" { 22 description = "The AWS instance type to use for clients." 23 default = "t2.medium" 24 } 25 26 variable "root_block_device_size" { 27 description = "The volume size of the root block device." 28 default = 16 29 } 30 31 variable "key_name" { 32 description = "Name of the SSH key used to provision EC2 instances." 33 } 34 35 variable "server_count" { 36 description = "The number of servers to provision." 37 default = "3" 38 } 39 40 variable "client_count" { 41 description = "The number of clients to provision." 42 default = "4" 43 } 44 45 46 variable "retry_join" { 47 description = "Used by Consul to automatically form a cluster." 48 type = "map" 49 50 default = { 51 provider = "aws" 52 tag_key = "ConsulAutoJoin" 53 tag_value = "auto-join" 54 } 55 } 56 57 variable "nomad_binary" { 58 description = "Used to replace the machine image installed Nomad binary." 59 default = "none" 60 } 61 62 provider "aws" { 63 region = "${var.region}" 64 } 65 66 module "hashistack" { 67 source = "../../modules/hashistack" 68 69 name = "${var.name}" 70 region = "${var.region}" 71 ami = "${var.ami}" 72 server_instance_type = "${var.server_instance_type}" 73 client_instance_type = "${var.client_instance_type}" 74 key_name = "${var.key_name}" 75 server_count = "${var.server_count}" 76 client_count = "${var.client_count}" 77 retry_join = "${var.retry_join}" 78 nomad_binary = "${var.nomad_binary}" 79 root_block_device_size = "${var.root_block_device_size}" 80 whitelist_ip = "${var.whitelist_ip}" 81 } 82 83 output "IP_Addresses" { 84 value = <<CONFIGURATION 85 86 Client public IPs: ${join(", ", module.hashistack.client_public_ips)} 87 Server public IPs: ${join(", ", module.hashistack.server_public_ips)} 88 89 To connect, add your private key and SSH into any client or server with 90 `ssh ubuntu@PUBLIC_IP`. You can test the integrity of the cluster by running: 91 92 $ consul members 93 $ nomad server members 94 $ nomad node status 95 96 If you see an error message like the following when running any of the above 97 commands, it usually indicates that the configuration script has not finished 98 executing: 99 100 "Error querying servers: Get http://127.0.0.1:4646/v1/agent/members: dial tcp 101 127.0.0.1:4646: getsockopt: connection refused" 102 103 Simply wait a few seconds and rerun the command if this occurs. 104 105 The Nomad UI can be accessed at http://${module.hashistack.server_lb_ip}:4646/ui. 106 The Consul UI can be accessed at http://${module.hashistack.server_lb_ip}:8500/ui. 107 108 Set the following for access from the Nomad CLI: 109 110 export NOMAD_ADDR=http://${module.hashistack.server_lb_ip}:4646 111 112 CONFIGURATION 113 }