variables.tf 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. variable "name" {
  2. description = "Base name used for created resources."
  3. type = string
  4. }
  5. variable "region" {
  6. description = "AWS region for informational outputs and examples."
  7. type = string
  8. }
  9. variable "kubernetes_version" {
  10. description = "EKS Kubernetes version."
  11. type = string
  12. default = "1.35"
  13. }
  14. variable "vpc_cidr" {
  15. description = "CIDR block for the new VPC."
  16. type = string
  17. default = "10.0.0.0/16"
  18. }
  19. variable "create_vpc" {
  20. description = "Whether to create a new VPC and subnets. Set to false to use existing networking."
  21. type = bool
  22. default = true
  23. }
  24. variable "existing_vpc_id" {
  25. description = "Existing VPC ID to use when create_vpc is false."
  26. type = string
  27. default = null
  28. nullable = true
  29. validation {
  30. condition = var.create_vpc || var.existing_vpc_id != null
  31. error_message = "existing_vpc_id must be set when create_vpc is false."
  32. }
  33. }
  34. variable "existing_public_subnet_ids" {
  35. description = "Existing public subnet IDs to use when create_vpc is false."
  36. type = list(string)
  37. default = []
  38. }
  39. variable "existing_private_subnet_ids" {
  40. description = "Existing private subnet IDs to use when create_vpc is false."
  41. type = list(string)
  42. default = []
  43. validation {
  44. condition = var.create_vpc || length(var.existing_private_subnet_ids) >= 2
  45. error_message = "At least two existing_private_subnet_ids must be provided when create_vpc is false."
  46. }
  47. }
  48. variable "availability_zone_count" {
  49. description = "How many availability zones to spread the cluster across."
  50. type = number
  51. default = 2
  52. validation {
  53. condition = var.availability_zone_count >= 2
  54. error_message = "availability_zone_count must be at least 2."
  55. }
  56. }
  57. variable "single_nat_gateway" {
  58. description = "Whether to create one shared NAT gateway instead of one per private subnet AZ."
  59. type = bool
  60. default = true
  61. }
  62. variable "cluster_endpoint_public_access" {
  63. description = "Whether the EKS API server endpoint is publicly accessible."
  64. type = bool
  65. default = true
  66. }
  67. variable "cluster_endpoint_private_access" {
  68. description = "Whether the EKS API server endpoint is privately accessible."
  69. type = bool
  70. default = true
  71. }
  72. variable "cluster_public_access_cidrs" {
  73. description = "CIDR ranges allowed to access the public EKS API endpoint."
  74. type = list(string)
  75. default = ["0.0.0.0/0"]
  76. }
  77. variable "node_instance_types" {
  78. description = "EC2 instance types for the managed node group."
  79. type = list(string)
  80. default = ["t3.medium"]
  81. }
  82. variable "node_capacity_type" {
  83. description = "Capacity type for the managed node group."
  84. type = string
  85. default = "ON_DEMAND"
  86. validation {
  87. condition = contains(["ON_DEMAND", "SPOT"], var.node_capacity_type)
  88. error_message = "node_capacity_type must be ON_DEMAND or SPOT."
  89. }
  90. }
  91. variable "node_disk_size" {
  92. description = "Disk size in GiB for worker nodes."
  93. type = number
  94. default = 20
  95. }
  96. variable "node_desired_size" {
  97. description = "Desired node count for the managed node group."
  98. type = number
  99. default = 2
  100. }
  101. variable "node_min_size" {
  102. description = "Minimum node count for the managed node group."
  103. type = number
  104. default = 2
  105. }
  106. variable "node_max_size" {
  107. description = "Maximum node count for the managed node group."
  108. type = number
  109. default = 4
  110. }
  111. variable "tags" {
  112. description = "Additional tags to apply to all supported resources."
  113. type = map(string)
  114. default = {}
  115. }
  116. variable "cluster_admin_principal_arns" {
  117. description = "Additional IAM principal ARNs to grant EKS cluster-admin access."
  118. type = list(string)
  119. default = []
  120. }
  121. variable "coredns_addon_version" {
  122. description = "Optional explicit version for the CoreDNS EKS addon."
  123. type = string
  124. default = null
  125. nullable = true
  126. }
  127. variable "kube_proxy_addon_version" {
  128. description = "Optional explicit version for the kube-proxy EKS addon."
  129. type = string
  130. default = null
  131. nullable = true
  132. }
  133. variable "vpc_cni_addon_version" {
  134. description = "Optional explicit version for the VPC CNI EKS addon."
  135. type = string
  136. default = null
  137. nullable = true
  138. }
  139. variable "pod_identity_agent_addon_version" {
  140. description = "Optional explicit version for the EKS Pod Identity Agent addon."
  141. type = string
  142. default = null
  143. nullable = true
  144. }