Skip to content

Commit 775ec28

Browse files
Feat: Add remote_network_config configuration (#258)
* Add remote_network_config configuration * Update examples/complete/main.tf Correct remote_network_config var reference Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent ca360c6 commit 775ec28

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ Module usage with two unmanaged worker groups:
440440
| <a name="input_public_access_cidrs"></a> [public\_access\_cidrs](#input\_public\_access\_cidrs) | Indicates which CIDR blocks can access the Amazon EKS public API server endpoint when enabled. EKS defaults this to a list with 0.0.0.0/0. | `list(string)` | <pre>[<br/> "0.0.0.0/0"<br/>]</pre> | no |
441441
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br/>Characters matching the regex will be removed from the ID elements.<br/>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
442442
| <a name="input_region"></a> [region](#input\_region) | OBSOLETE (not needed): AWS Region | `string` | `null` | no |
443+
| <a name="input_remote_network_config"></a> [remote\_network\_config](#input\_remote\_network\_config) | Configuration block for the cluster remote network configuration | <pre>object({<br/> remote_node_networks_cidrs = list(string)<br/> remote_pod_networks_cidrs = optional(list(string))<br/> })</pre> | `null` | no |
443444
| <a name="input_service_ipv4_cidr"></a> [service\_ipv4\_cidr](#input\_service\_ipv4\_cidr) | The CIDR block to assign Kubernetes service IP addresses from.<br/>You can only specify a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created. | `string` | `null` | no |
444445
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
445446
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs to launch the cluster in | `list(string)` | n/a | yes |

examples/complete/fixtures.us-east-2.tfvars

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ upgrade_policy = {
5959
zonal_shift_config = {
6060
enabled = true
6161
}
62+
63+
64+
remote_network_config = {
65+
remote_node_networks_cidrs = ["10.255.0.0/16"]
66+
remote_pod_networks_cidrs = ["192.168.0.0/16"]
67+
}

examples/complete/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ module "eks_cluster" {
129129

130130
kubernetes_network_ipv6_enabled = local.private_ipv6_enabled
131131

132+
remote_network_config = var.remote_network_config
133+
132134
context = module.this.context
133135

134136
cluster_depends_on = [module.subnets]

examples/complete/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,12 @@ variable "private_ipv6_enabled" {
141141
default = false
142142
description = "Whether to use IPv6 addresses for the pods in the node group"
143143
}
144+
145+
variable "remote_network_config" {
146+
description = "Configuration block for the cluster remote network configuration"
147+
type = object({
148+
remote_node_networks_cidrs = list(string)
149+
remote_pod_networks_cidrs = optional(list(string))
150+
})
151+
default = null
152+
}

main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,28 @@ resource "aws_eks_cluster" "default" {
110110
}
111111
}
112112

113+
dynamic "remote_network_config" {
114+
for_each = var.remote_network_config != null ? [var.remote_network_config] : []
115+
116+
content {
117+
dynamic "remote_node_networks" {
118+
for_each = [remote_network_config.value.remote_node_networks_cidrs]
119+
120+
content {
121+
cidrs = remote_network_config.value.remote_node_networks_cidrs
122+
}
123+
}
124+
125+
dynamic "remote_pod_networks" {
126+
for_each = remote_network_config.value.remote_pod_networks_cidrs != null ? [remote_network_config.value.remote_pod_networks_cidrs] : []
127+
128+
content {
129+
cidrs = remote_network_config.value.remote_pod_networks_cidrs
130+
}
131+
}
132+
}
133+
}
134+
113135
dynamic "upgrade_policy" {
114136
for_each = var.upgrade_policy != null ? [var.upgrade_policy] : []
115137
content {

variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,12 @@ variable "custom_ingress_rules" {
381381
A List of Objects, which are custom security group rules that
382382
EOT
383383
}
384+
385+
variable "remote_network_config" {
386+
description = "Configuration block for the cluster remote network configuration"
387+
type = object({
388+
remote_node_networks_cidrs = list(string)
389+
remote_pod_networks_cidrs = optional(list(string))
390+
})
391+
default = null
392+
}

0 commit comments

Comments
 (0)