Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to define individual oauth scopes to node pools #94

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down
4 changes: 1 addition & 3 deletions cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ module "gke" {
},
]

node_pools_oauth_scopes = {
all = []

pool-01 = []

pool-02 = []
}

node_pools_metadata = {
all = {}

Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
morgante marked this conversation as resolved.
Show resolved Hide resolved
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"
Expand Down