diff --git a/modules/ionos-cidr-workaround/README.md b/modules/ionos-cidr-workaround/README.md index 9eaf695..3ad9edb 100644 --- a/modules/ionos-cidr-workaround/README.md +++ b/modules/ionos-cidr-workaround/README.md @@ -18,9 +18,10 @@ No modules. | Name | Description | |------|-------------| -| [nicIndex](#output\_nicIndex) | n/a | -| [node\_lan\_ips](#output\_node\_lan\_ips) | n/a | -| [prefix](#output\_prefix) | n/a | +| [nicIndex](#output\_nicIndex) | Index of the NIC used by the provided LAN in the Kubernetes nodes. | +| [node\_lan\_ips](#output\_node\_lan\_ips) | List of the IPs assigned to the currently deployed Kubernetes nodes. When using this keep in mind that some of the IPs will change during maintenance. | +| [nodes\_full\_ip\_range](#output\_nodes\_full\_ip\_range) | List of all the IPs in the range used by the Kubernetes cluster (IPs 10 to 255 in the prefix CIDR block). | +| [prefix](#output\_prefix) | CIDR block used by the Kubernetes cluster, for example '10.0.0.0/24'. | ## Requirements | Name | Version | diff --git a/modules/ionos-cidr-workaround/locals.tf b/modules/ionos-cidr-workaround/locals.tf index 4f13f8a..c60db8c 100644 --- a/modules/ionos-cidr-workaround/locals.tf +++ b/modules/ionos-cidr-workaround/locals.tf @@ -4,4 +4,5 @@ locals { node_servers = data.ionoscloud_servers.k8s_nodes[*].servers[*] # it gets a list of all the nics that are attached to the provided servers and extracts the ips as a list of only the nics, that are conneted via the provided lan node_lan_ips = flatten([for server_idx, server in local.node_servers : [ for nic in flatten(server[*].nics[*]) : nic.ips if nic.lan == tonumber(var.lan_id) ]]) + nodes_full_ip_range = [for x in range(10,256) : cidrhost(local.prefix, x)] } \ No newline at end of file diff --git a/modules/ionos-cidr-workaround/output.tf b/modules/ionos-cidr-workaround/output.tf index 9be5fdc..af5ebd8 100644 --- a/modules/ionos-cidr-workaround/output.tf +++ b/modules/ionos-cidr-workaround/output.tf @@ -1,11 +1,19 @@ output "nicIndex" { value = local.nicIndex + description = "Index of the NIC used by the provided LAN in the Kubernetes nodes." } output "prefix" { value = local.prefix + description = "CIDR block used by the Kubernetes cluster, for example '10.0.0.0/24'." } output "node_lan_ips" { value = local.node_lan_ips -} \ No newline at end of file + description = "List of the IPs assigned to the currently deployed Kubernetes nodes. When using this keep in mind that some of the IPs will change during maintenance." +} + +output "nodes_full_ip_range" { + value = local.nodes_full_ip_range + description = "List of all the IPs in the range used by the Kubernetes cluster (IPs 10 to 255 in the prefix CIDR block)." +}