diff --git a/README.md b/README.md index 6f39a4e573..affa9f9184 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ Then perform the following commands on the root folder: | network | The VPC network to host the cluster in (required) | string | - | yes | | network_policy | Enable network policy addon | string | `false` | no | | network_project_id | The project ID of the shared VPC's host (for shared vpc support) | string | `` | no | +| remove_default_node_pool | Boolean value determining removal of default node pool | bool | false | no | | node_pools | List of maps containing node pools | list | `` | no | | node_pools_labels | Map of maps containing node labels by node-pool name | map | `` | no | | node_pools_tags | Map of lists containing node network tags by node-pool name | map | `` | no | diff --git a/cluster_regional.tf b/cluster_regional.tf index d71dc2a8d3..1774b38bd6 100644 --- a/cluster_regional.tf +++ b/cluster_regional.tf @@ -26,8 +26,8 @@ resource "google_container_cluster" "primary" { region = "${var.region}" additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"] - network = "${data.google_compute_network.gke_network.self_link}" - subnetwork = "${data.google_compute_subnetwork.gke_subnetwork.self_link}" + network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}" + subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}" min_master_version = "${local.kubernetes_version}" logging_service = "${var.logging_service}" @@ -81,6 +81,8 @@ resource "google_container_cluster" "primary" { service_account = "${lookup(var.node_pools[0], "service_account", var.service_account)}" } } + + remove_default_node_pool = "${var.remove_default_node_pool}" } /****************************************** diff --git a/cluster_zonal.tf b/cluster_zonal.tf index 5b6efb4220..209712a985 100644 --- a/cluster_zonal.tf +++ b/cluster_zonal.tf @@ -26,8 +26,8 @@ resource "google_container_cluster" "zonal_primary" { zone = "${var.zones[0]}" additional_zones = ["${slice(var.zones,1,length(var.zones))}"] - network = "${data.google_compute_network.gke_network.self_link}" - subnetwork = "${data.google_compute_subnetwork.gke_subnetwork.self_link}" + network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}" + subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}" min_master_version = "${local.kubernetes_version}" logging_service = "${var.logging_service}" @@ -81,6 +81,8 @@ resource "google_container_cluster" "zonal_primary" { service_account = "${lookup(var.node_pools[0], "service_account", var.service_account)}" } } + + remove_default_node_pool = "${var.remove_default_node_pool}" } /****************************************** diff --git a/variables.tf b/variables.tf index 606557914c..98b9977564 100644 --- a/variables.tf +++ b/variables.tf @@ -117,6 +117,11 @@ variable "ip_range_services" { description = "The secondary ip range to use for pods" } +variable "remove_default_node_pool" { + description = "Remove default node pool while setting up the cluster" + default = false +} + variable "node_pools" { type = "list" description = "List of maps containing node pools"