diff --git a/README.md b/README.md index adbd19d3d8..5ea5caab01 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,14 @@ module "gke" { }, ] + node_pools_oauth_scopes = { + all = [] + + default-node-pool = [ + "https://www.googleapis.com/auth/cloud-platform", + ] + } + node_pools_labels = { all = {} diff --git a/cluster_regional.tf b/cluster_regional.tf index 69d6ede11d..5a91fe3922 100644 --- a/cluster_regional.tf +++ b/cluster_regional.tf @@ -123,9 +123,7 @@ resource "google_container_node_pool" "pools" { service_account = "${lookup(var.node_pools[count.index], "service_account", local.service_account)}" preemptible = "${lookup(var.node_pools[count.index], "preemptible", false)}" - oauth_scopes = [ - "https://www.googleapis.com/auth/cloud-platform", - ] + oauth_scopes = ["${concat(var.node_pools_oauth_scopes["all"], var.node_pools_oauth_scopes[lookup(var.node_pools[count.index], "name")])}"] } lifecycle { diff --git a/cluster_zonal.tf b/cluster_zonal.tf index f038ca643a..68f770eb65 100644 --- a/cluster_zonal.tf +++ b/cluster_zonal.tf @@ -123,9 +123,7 @@ resource "google_container_node_pool" "zonal_pools" { service_account = "${lookup(var.node_pools[count.index], "service_account", local.service_account)}" preemptible = "${lookup(var.node_pools[count.index], "preemptible", false)}" - oauth_scopes = [ - "https://www.googleapis.com/auth/cloud-platform", - ] + oauth_scopes = ["${concat(var.node_pools_oauth_scopes["all"], var.node_pools_oauth_scopes[lookup(var.node_pools[count.index], "name")])}"] } lifecycle { diff --git a/examples/node_pool/main.tf b/examples/node_pool/main.tf index cc901d5403..3d76482ac2 100644 --- a/examples/node_pool/main.tf +++ b/examples/node_pool/main.tf @@ -63,6 +63,14 @@ module "gke" { }, ] + node_pools_oauth_scopes = { + all = [] + + pool-01 = [] + + pool-02 = [] + } + node_pools_metadata = { all = {} diff --git a/variables.tf b/variables.tf index d5b571491a..8bdb614e45 100644 --- a/variables.tf +++ b/variables.tf @@ -175,6 +175,16 @@ variable "node_pools_tags" { } } +variable "node_pools_oauth_scopes" { + type = "map" + description = "Map of lists containing node oauth scopes by node-pool name" + + default = { + all = ["https://www.googleapis.com/auth/cloud-platform"] + default-node-pool = [] + } +} + variable "stub_domains" { type = "map" description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"