Skip to content

Commit 04d4866

Browse files
author
Ryan C Koch
committed
remove node_service_account variable
1 parent 033e44a commit 04d4866

File tree

24 files changed

+67
-117
lines changed

24 files changed

+67
-117
lines changed

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ module "gke" {
4343
subnetwork = "us-central1-01"
4444
ip_range_pods = "us-central1-01-gke-01-pods"
4545
ip_range_services = "us-central1-01-gke-01-services"
46-
node_service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
4746
http_load_balancing = false
4847
horizontal_pod_autoscaling = true
4948
kubernetes_dashboard = true
5049
network_policy = true
5150
5251
node_pools = [
5352
{
54-
name = "default-node-pool"
55-
machine_type = "n1-standard-2"
56-
min_count = 1
57-
max_count = 100
58-
disk_size_gb = 100
59-
disk_type = "pd-standard"
60-
image_type = "COS"
61-
auto_repair = true
62-
auto_upgrade = true
53+
name = "default-node-pool"
54+
machine_type = "n1-standard-2"
55+
min_count = 1
56+
max_count = 100
57+
disk_size_gb = 100
58+
disk_type = "pd-standard"
59+
image_type = "COS"
60+
auto_repair = true
61+
auto_upgrade = true
62+
service_account = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
6363
},
6464
]
6565
@@ -124,7 +124,6 @@ Then perform the following commands on the root folder:
124124
| node_pools_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
125125
| node_pools_tags | Map of lists containing node network tags by node-pool name | map | `<map>` | no |
126126
| node_pools_taints | Map of lists containing node taints by node-pool name | map | `<map>` | no |
127-
| node_service_account | Service account to associate to the nodes. Defaults to the compute default service account on the project.) | string | `` | no |
128127
| node_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `` | no |
129128
| non_masquerade_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list | `<list>` | no |
130129
| project_id | The project ID to host the cluster in (required) | string | - | yes |

cluster_regional.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ resource "google_container_cluster" "primary" {
7373
name = "default-pool"
7474

7575
node_config {
76-
service_account = "${var.node_service_account}"
76+
service_account = "${lookup(var.node_pools[0], "service_account", "")}"
7777
}
7878
}
7979
}
@@ -109,7 +109,7 @@ resource "google_container_node_pool" "pools" {
109109

110110
disk_size_gb = "${lookup(var.node_pools[count.index], "disk_size_gb", 100)}"
111111
disk_type = "${lookup(var.node_pools[count.index], "disk_type", "pd-standard")}"
112-
service_account = "${lookup(var.node_pools[count.index], "service_account", var.node_service_account)}"
112+
service_account = "${lookup(var.node_pools[count.index], "service_account", "")}"
113113

114114
oauth_scopes = [
115115
"https://www.googleapis.com/auth/cloud-platform",

cluster_zonal.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ resource "google_container_cluster" "zonal_primary" {
7373
name = "default-pool"
7474

7575
node_config {
76-
service_account = "${var.node_service_account}"
76+
service_account = "${lookup(var.node_pools[0], "service_account", "")}"
7777
}
7878
}
7979
}
@@ -109,7 +109,7 @@ resource "google_container_node_pool" "zonal_pools" {
109109

110110
disk_size_gb = "${lookup(var.node_pools[count.index], "disk_size_gb", 100)}"
111111
disk_type = "${lookup(var.node_pools[count.index], "disk_type", "pd-standard")}"
112-
service_account = "${lookup(var.node_pools[count.index], "service_account", var.node_service_account)}"
112+
service_account = "${lookup(var.node_pools[count.index], "service_account", "")}"
113113

114114
oauth_scopes = [
115115
"https://www.googleapis.com/auth/cloud-platform",

examples/deploy_service/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Expected variables:
1515
- `subnetwork`
1616
- `ip_range_pods`
1717
- `ip_range_services`
18-
- `node_service_account` - Only needed if you've deleted the default service account from your project
1918

2019
To provision this example, run the following from within this directory:
2120
- `terraform init` to get the plugins

examples/deploy_service/main.tf

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ provider "kubernetes" {
3232
data "google_client_config" "default" {}
3333

3434
module "gke" {
35-
source = "../../"
36-
project_id = "${var.project_id}"
37-
name = "deploy-service-cluster"
38-
region = "${var.region}"
39-
network = "${var.network}"
40-
subnetwork = "${var.subnetwork}"
41-
ip_range_pods = "${var.ip_range_pods}"
42-
ip_range_services = "${var.ip_range_services}"
43-
node_service_account = "${var.node_service_account}"
35+
source = "../../"
36+
project_id = "${var.project_id}"
37+
name = "deploy-service-cluster"
38+
region = "${var.region}"
39+
network = "${var.network}"
40+
subnetwork = "${var.subnetwork}"
41+
ip_range_pods = "${var.ip_range_pods}"
42+
ip_range_services = "${var.ip_range_services}"
4443
}
4544

4645
resource "kubernetes_pod" "nginx-example" {

examples/deploy_service/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,3 @@ variable "ip_range_pods" {
3737
variable "ip_range_services" {
3838
description = "The secondary ip range to use for pods"
3939
}
40-
41-
variable "node_service_account" {
42-
description = "Service account to associate to the nodes (defaults to the default service account on the project)"
43-
default = ""
44-
}

examples/node_pool/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Expected variables:
99
- `subnetwork`
1010
- `ip_range_pods`
1111
- `ip_range_services`
12-
- `node_service_account` - Only needed if you've deleted the default service account from your project
12+
- `pool_01_service_account` - Only needed if you've deleted the default service account from your project
1313

1414
To provision this example, run the following from within this directory:
1515
- `terraform init` to get the plugins

examples/node_pool/main.tf

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ provider "google" {
2323
}
2424

2525
module "gke" {
26-
source = "../../"
27-
project_id = "${var.project_id}"
28-
name = "node-pool-cluster"
29-
region = "${var.region}"
30-
network = "${var.network}"
31-
subnetwork = "${var.subnetwork}"
32-
ip_range_pods = "${var.ip_range_pods}"
33-
ip_range_services = "${var.ip_range_services}"
34-
node_service_account = "${var.node_service_account}"
26+
source = "../../"
27+
project_id = "${var.project_id}"
28+
name = "node-pool-cluster"
29+
region = "${var.region}"
30+
network = "${var.network}"
31+
subnetwork = "${var.subnetwork}"
32+
ip_range_pods = "${var.ip_range_pods}"
33+
ip_range_services = "${var.ip_range_services}"
3534

3635
node_pools = [
3736
{

examples/node_pool/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ variable "ip_range_services" {
3838
description = "The secondary ip range to use for pods"
3939
}
4040

41-
variable "node_service_account" {
42-
description = "Service account to associate to the nodes (defaults to the default service account on the project)"
43-
default = ""
44-
}
45-
4641
variable "pool_01_service_account" {
4742
description = "Service account to associate to the nodes on pool-01"
4843
}

examples/shared_vpc/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Expected variables:
1010
- `subnetwork`
1111
- `ip_range_pods`
1212
- `ip_range_services`
13-
- `node_service_account` - Only needed if you've deleted the default service account from your project
1413

1514
To provision this example, run the following from within this directory:
1615
- `terraform init` to get the plugins

0 commit comments

Comments
 (0)