diff --git a/contrib/terraform/openstack/kubespray.tf b/contrib/terraform/openstack/kubespray.tf index 95c95043e5fa3c91b29ada8390a771f2adcf0142..33fbff7625809abe7d629f0a36bfc6da81bd6f80 100644 --- a/contrib/terraform/openstack/kubespray.tf +++ b/contrib/terraform/openstack/kubespray.tf @@ -32,6 +32,7 @@ module "compute" { cluster_name = "${var.cluster_name}" az_list = "${var.az_list}" + az_list_node = "${var.az_list_node}" number_of_k8s_masters = "${var.number_of_k8s_masters}" number_of_k8s_masters_no_etcd = "${var.number_of_k8s_masters_no_etcd}" number_of_etcd = "${var.number_of_etcd}" diff --git a/contrib/terraform/openstack/modules/compute/main.tf b/contrib/terraform/openstack/modules/compute/main.tf index 11fae661739efe4a86559cc1dfb778015286f6ed..8796c605a90271867abee26a66d5152538700ef4 100644 --- a/contrib/terraform/openstack/modules/compute/main.tf +++ b/contrib/terraform/openstack/modules/compute/main.tf @@ -546,7 +546,7 @@ resource "openstack_compute_instance_v2" "k8s_master_no_floating_ip_no_etcd_cust resource "openstack_compute_instance_v2" "k8s_node" { name = "${var.cluster_name}-k8s-node-${count.index+1}" count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes : 0}" - availability_zone = "${element(var.az_list, count.index)}" + availability_zone = "${element(var.az_list_node, count.index)}" image_name = "${var.image}" flavor_id = "${var.flavor_k8s_node}" key_pair = "${openstack_compute_keypair_v2.k8s.name}" @@ -581,7 +581,7 @@ resource "openstack_compute_instance_v2" "k8s_node" { resource "openstack_compute_instance_v2" "k8s_node_custom_volume_size" { name = "${var.cluster_name}-k8s-node-${count.index+1}" count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes : 0}" - availability_zone = "${element(var.az_list, count.index)}" + availability_zone = "${element(var.az_list_node, count.index)}" image_name = "${var.image}" flavor_id = "${var.flavor_k8s_node}" key_pair = "${openstack_compute_keypair_v2.k8s.name}" @@ -625,7 +625,7 @@ resource "openstack_compute_instance_v2" "k8s_node_custom_volume_size" { resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" { name = "${var.cluster_name}-k8s-node-nf-${count.index+1}" count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}" - availability_zone = "${element(var.az_list, count.index)}" + availability_zone = "${element(var.az_list_node, count.index)}" image_name = "${var.image}" flavor_id = "${var.flavor_k8s_node}" key_pair = "${openstack_compute_keypair_v2.k8s.name}" @@ -656,7 +656,7 @@ resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" { resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip_custom_volume_size" { name = "${var.cluster_name}-k8s-node-nf-${count.index+1}" count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}" - availability_zone = "${element(var.az_list, count.index)}" + availability_zone = "${element(var.az_list_node, count.index)}" image_name = "${var.image}" flavor_id = "${var.flavor_k8s_node}" key_pair = "${openstack_compute_keypair_v2.k8s.name}" diff --git a/contrib/terraform/openstack/modules/compute/variables.tf b/contrib/terraform/openstack/modules/compute/variables.tf index 61108059fee4c6451afd589aa7e37acbc57d4998..4fab83c5736ca1f060ea80b4dbc13a2f45460650 100644 --- a/contrib/terraform/openstack/modules/compute/variables.tf +++ b/contrib/terraform/openstack/modules/compute/variables.tf @@ -1,7 +1,11 @@ variable "cluster_name" {} variable "az_list" { - type = "list" + type = list(string) +} + +variable "az_list_node" { + type = list(string) } variable "number_of_k8s_masters" {} @@ -110,4 +114,4 @@ variable "use_access_ip" {} variable "use_server_groups" { type = bool -} \ No newline at end of file +} diff --git a/contrib/terraform/openstack/variables.tf b/contrib/terraform/openstack/variables.tf index 1fd294aad7aae6fdd84a30c5be35ee66dbcf3b85..1ab16e5e94f686ab8edee1a0214e67747311f7a7 100644 --- a/contrib/terraform/openstack/variables.tf +++ b/contrib/terraform/openstack/variables.tf @@ -3,8 +3,14 @@ variable "cluster_name" { } variable "az_list" { - description = "List of Availability Zones available in your OpenStack cluster" - type = "list" + description = "List of Availability Zones to use for masters in your OpenStack cluster" + type = list(string) + default = ["nova"] +} + +variable "az_list_node" { + description = "List of Availability Zones to use for nodes in your OpenStack cluster" + type = list(string) default = ["nova"] } @@ -213,4 +219,4 @@ variable "use_access_ip" { variable "use_server_groups" { default = false -} \ No newline at end of file +}