From a06f641b6c384ed1f6a9d913fb2789f668b50ded Mon Sep 17 00:00:00 2001 From: Derek Lemon Date: Thu, 14 Jun 2018 16:40:32 +0000 Subject: [PATCH 1/3] Configurable openstack subnet cidr --- contrib/terraform/openstack/modules/network/main.tf | 2 +- contrib/terraform/openstack/modules/network/variables.tf | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/terraform/openstack/modules/network/main.tf b/contrib/terraform/openstack/modules/network/main.tf index 2c461c784..7c02869d4 100644 --- a/contrib/terraform/openstack/modules/network/main.tf +++ b/contrib/terraform/openstack/modules/network/main.tf @@ -12,7 +12,7 @@ resource "openstack_networking_network_v2" "k8s" { resource "openstack_networking_subnet_v2" "k8s" { name = "${var.cluster_name}-internal-network" network_id = "${openstack_networking_network_v2.k8s.id}" - cidr = "10.0.0.0/24" + cidr = "${var.subnet_cidr}" ip_version = 4 dns_nameservers = "${var.dns_nameservers}" } diff --git a/contrib/terraform/openstack/modules/network/variables.tf b/contrib/terraform/openstack/modules/network/variables.tf index a7952bced..c8382b15e 100644 --- a/contrib/terraform/openstack/modules/network/variables.tf +++ b/contrib/terraform/openstack/modules/network/variables.tf @@ -7,3 +7,8 @@ variable "cluster_name" {} variable "dns_nameservers" { type = "list" } + +variable "subnet_cidr" { + type = "string" + default = "10.0.0.0/24" +} From ab345c5f69e22de64482b3952f0fa779b2a55cb2 Mon Sep 17 00:00:00 2001 From: Derek Lemon Date: Thu, 14 Jun 2018 17:31:04 +0000 Subject: [PATCH 2/3] Change was not picked up --- contrib/terraform/openstack/modules/network/variables.tf | 5 +---- contrib/terraform/openstack/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/terraform/openstack/modules/network/variables.tf b/contrib/terraform/openstack/modules/network/variables.tf index c8382b15e..6494358aa 100644 --- a/contrib/terraform/openstack/modules/network/variables.tf +++ b/contrib/terraform/openstack/modules/network/variables.tf @@ -8,7 +8,4 @@ variable "dns_nameservers" { type = "list" } -variable "subnet_cidr" { - type = "string" - default = "10.0.0.0/24" -} +variable "subnet_cidr" {} diff --git a/contrib/terraform/openstack/variables.tf b/contrib/terraform/openstack/variables.tf index d49746c92..04e0d0c62 100644 --- a/contrib/terraform/openstack/variables.tf +++ b/contrib/terraform/openstack/variables.tf @@ -97,6 +97,12 @@ variable "network_name" { default = "internal" } +variable "subnet_cidr" { + description = "Subnet CIDR block." + type = "string" + default = "10.0.0.0/24" +} + variable "dns_nameservers" { description = "An array of DNS name server names used by hosts in this subnet." type = "list" From 27d62941b258df2cab78363f0abf3ab5299383d8 Mon Sep 17 00:00:00 2001 From: Derek Lemon Date: Thu, 14 Jun 2018 17:41:58 +0000 Subject: [PATCH 3/3] Add the subnet_cidr as a required argument to the network module --- contrib/terraform/openstack/kubespray.tf | 1 + contrib/terraform/openstack/sample-inventory/cluster.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/contrib/terraform/openstack/kubespray.tf b/contrib/terraform/openstack/kubespray.tf index c501302de..b3ea369c2 100644 --- a/contrib/terraform/openstack/kubespray.tf +++ b/contrib/terraform/openstack/kubespray.tf @@ -3,6 +3,7 @@ module "network" { external_net = "${var.external_net}" network_name = "${var.network_name}" + subnet_cidr = "${var.subnet_cidr}" cluster_name = "${var.cluster_name}" dns_nameservers = "${var.dns_nameservers}" } diff --git a/contrib/terraform/openstack/sample-inventory/cluster.tf b/contrib/terraform/openstack/sample-inventory/cluster.tf index 7830d2159..a793bfaa5 100644 --- a/contrib/terraform/openstack/sample-inventory/cluster.tf +++ b/contrib/terraform/openstack/sample-inventory/cluster.tf @@ -41,5 +41,6 @@ number_of_k8s_nodes_no_floating_ip = 4 # networking network_name = "" external_net = "" +subnet_cidr = "" floatingip_pool = ""