1# ---------------------------------------------------------------------------------------------------------------------
2# ENVIRONMENT VARIABLES
3# Define these secrets as environment variables
4# ---------------------------------------------------------------------------------------------------------------------
5
6# AWS_ACCESS_KEY_ID
7# AWS_SECRET_ACCESS_KEY
8# AWS_DEFAULT_REGION
9
10# ---------------------------------------------------------------------------------------------------------------------
11# OPTIONAL PARAMETERS
12# These parameters have reasonable defaults.
13# ---------------------------------------------------------------------------------------------------------------------
14
15variable "consul_ami_id" {
16  description = "The ID of the AMI to run in the cluster. This should be an AMI built from the Packer template under examples/consul-ami/consul.json. To keep this example simple, we run the same AMI on both server and client nodes, but in real-world usage, your client nodes would also run your apps. If the default value is used, Terraform will look up the latest AMI build automatically."
17  type        = string
18  default     = null
19}
20
21variable "cluster_name" {
22  description = "What to name the Consul cluster and all of its associated resources"
23  type        = string
24  default     = "consul-example"
25}
26
27variable "num_servers" {
28  description = "The number of Consul server nodes to deploy. We strongly recommend using 3 or 5."
29  type        = number
30  default     = 3
31}
32
33variable "num_clients" {
34  description = "The number of Consul client nodes to deploy. You typically run the Consul client alongside your apps, so set this value to however many Instances make sense for your app code."
35  type        = number
36  default     = 2
37}
38
39variable "cluster_tag_key" {
40  description = "The tag the EC2 Instances will look for to automatically discover each other and form a cluster."
41  type        = string
42  default     = "consul-servers"
43}
44
45variable "vpc_az" {
46  type        = list(string)
47  description = "VPC Availability Zone"
48  validation {
49    condition     = length(var.vpc_az) == 2
50    error_message = "VPC needs at least two Availability Zones for ALB to work."
51  }
52}
53
54variable "vpc_name" {
55  description = "Name of the VPC"
56}
57
58variable "vpc_cidr" {
59  description = "List of CIDR blocks for the VPC module"
60}
61
62variable "public_subnet_cidrs" {
63  type        = list(string)
64  description = "CIDR Block for the Public Subnet, must be within VPC CIDR range"
65}
66
67variable "private_subnet_cidrs" {
68  type        = list(string)
69  description = "CIDR Block for the Private Subnet, must be within VPC CIDR range"
70}
71
72variable "test_server_ami" {
73  type        = string
74  description = "The AMI ID from the Packer generated image"
75  default     = null
76}
77
78variable "test_instance_type" {
79  type        = string
80  description = "AWS Instance type for all test servers"
81  default     = "t2.small"
82}
83
84variable "test_public_ip" {
85  type        = bool
86  description = "Should the test servers have a public IP?"
87}
88
89variable "instance_type" {
90  type        = string
91  description = "Instance Type for all instances in the Consul Cluster"
92  default     = "m5n.large"
93}
94
95variable "ami_owners" {
96  type        = list(string)
97  description = "The account owner number which the desired AMI is in"
98}
99
100variable "consul_download_url" {
101  type        = string
102  description = "URL to download the Consul binary from"
103  default     = ""
104}
105
106variable "consul_version" {
107  type        = string
108  description = "Version of the Consul binary to install"
109  default     = "1.9.0"
110}
111
112