-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
108 lines (87 loc) · 2.63 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* Project Tags */
variable "project_owner" {
description = "Tag to identify the resource owner name"
default = "Mateo Arboleda"
}
variable "project_email" {
description = "Tag to identify the resource owner email"
default = "mateo.arboleda@endava.com"
}
variable "project_name" {
description = "Tag to identify the resource project name"
default = "Kubernetes"
}
variable "is_project_terraformed" {
description = "Tag to identify if the project is managed by Terraform"
default = "true"
}
/* Region */
variable "region" {
type = map(string)
default = {
"development" = "us-east-1"
"qa" = "us-east-1"
"staging" = "us-east-2"
"production" = "us-east-2"
}
}
/* Environment Definition */
variable "environment" {
description = "Environment Definition - Options: development, qa, staging, production"
default = "development"
}
/* VPC Configuration */
variable "vpc_name" {
description = "VPC Name"
default = "terraform-eks-02"
}
variable "cidr_ab" {
type = map
default = {
development = "172.24"
qa = "172.25"
staging = "172.26"
production = "172.27"
}
}
locals {
cidr_c_private_subnets = 1
cidr_c_public_subnets = 64
max_private_subnets = 1
max_public_subnets = 2
}
locals {
availability_zones = data.aws_availability_zones.available.names
}
/* Subnets Configuration */
locals {
private_subnets = [
for az in local.availability_zones :
"${lookup(var.cidr_ab, var.environment)}.${local.cidr_c_private_subnets + index(local.availability_zones, az)}.0/24"
if index(local.availability_zones, az) < local.max_private_subnets
]
public_subnets = [
for az in local.availability_zones :
"${lookup(var.cidr_ab, var.environment)}.${local.cidr_c_public_subnets + index(local.availability_zones, az)}.0/24"
if index(local.availability_zones, az) < local.max_public_subnets
]
}
/* EKS Wordpress Cluster */
variable "eks_cluster_name" {
description = "EKS Cluster Name"
default = "terraform-eks-02"
}
/* EKS Wordpress Worker Nodes */
variable "eks_instance_type" {
description = "EKS Instance Type"
default = "t2.medium"
}
/* EKS Auto Scaling Group Max Size */
variable "eks_asg_max_size" {
description = "EKS Auto Scaling Group Max Size"
default = 1
}
variable "asg_desired_capacity" {
description = "Desired Capacity"
default = 1
}