Skip to content

Commit

Permalink
feat(network): add network CIDR variables for enhanced configuration
Browse files Browse the repository at this point in the history
Introduced variables for network, node, pod, and service IPv4 CIDRs in `variables.tf` to allow dynamic network configuration.

Signed-off-by: Marcel Richter <[email protected]>
  • Loading branch information
mrclrchtr committed Mar 31, 2024
1 parent 49a652e commit 7286ead
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions network.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
locals {
# https://github.com/hetznercloud/hcloud-cloud-controller-manager/blob/main/docs/deploy_with_networks.md#considerations-on-the-ip-ranges
network_ipv4_cidr = "10.0.0.0/16"
node_ipv4_cidr = "10.0.1.0/24"
network_ipv4_cidr = var.network_ipv4_cidr
node_ipv4_cidr = var.node_ipv4_cidr
node_ipv4_cidr_mask_size = split("/", local.node_ipv4_cidr)[1] # 24
pod_ipv4_cidr = "10.0.16.0/20"
service_ipv4_cidr = "10.0.8.0/21"
pod_ipv4_cidr = var.pod_ipv4_cidr
service_ipv4_cidr = var.service_ipv4_cidr
}

resource "hcloud_network" "this" {
Expand Down
24 changes: 24 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,30 @@ variable "enable_kube_span" {
description = "If true, the KubeSpan Feature (with \"Kubernetes registry\" mode) will be enabled."
}

variable "network_ipv4_cidr" {
description = "The main network cidr that all subnets will be created upon."
type = string
default = "10.0.0.0/16"
}

variable "node_ipv4_cidr" {
description = "Node CIDR, used for the nodes (control plane and worker nodes) in the cluster."
type = string
default = "10.0.1.0/24"
}

variable "pod_ipv4_cidr" {
description = "Pod CIDR, used for the pods in the cluster."
type = string
default = "10.0.16.0/20"
}

variable "service_ipv4_cidr" {
description = "Service CIDR, used for the services in the cluster."
type = string
default = "10.0.8.0/21"
}

# Server
variable "talos_version" {
type = string
Expand Down

0 comments on commit 7286ead

Please sign in to comment.