Skip to content

Commit

Permalink
Merge pull request #236 from paulpalamarchuk/add_storage_viewer_role_…
Browse files Browse the repository at this point in the history
…to_sa

Add 'grant_registry_access' variable to add 'storage.objectViewer'-role to SA
  • Loading branch information
morgante committed Aug 22, 2019
2 parents ca1788c + 7f9559c commit 0fca886
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Extending the adopted spec, each change should have a link to its corresponding
## [Unreleased]
### Added

* Added `grant_registry_access` variable to grant Container Registry access to created SA [#236]
* Support for Intranode Visbiility (IV) and Veritical Pod Autoscaling (VPA) beta features [#216]
* Support for Workload Identity beta feature [#234]
* Support for Google Groups based RBAC beta feature [#217]
Expand Down Expand Up @@ -169,6 +170,7 @@ Extending the adopted spec, each change should have a link to its corresponding
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0

[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236
[#217]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/217
[#234]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/234
[#216]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/216
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| create\_service\_account | Defines if service account specified to run nodes should be created. | bool | `"true"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
| http\_load\_balancing | Enable httpload balancer addon | bool | `"true"` | no |
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | number | `"0"` | no |
Expand Down
8 changes: 8 additions & 0 deletions autogen/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ resource "google_project_iam_member" "cluster_service_account-monitoring_viewer"
role = "roles/monitoring.viewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

resource "google_project_iam_member" "cluster_service_account-gcr" {
count = var.create_service_account && var.grant_registry_access ? 1 : 0
project = var.project_id
role = "roles/storage.objectViewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

6 changes: 6 additions & 0 deletions autogen/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ variable "create_service_account" {
default = true
}

variable "grant_registry_access" {
type = bool
description = "Grants created cluster-specific service account storage.objectViewer role."
default = false
}

variable "service_account" {
type = string
description = "The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
| http\_load\_balancing | Enable httpload balancer addon | bool | `"true"` | no |
| identity\_namespace | Workload Identity namespace | string | `""` | no |
Expand Down
8 changes: 8 additions & 0 deletions modules/beta-private-cluster/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ resource "google_project_iam_member" "cluster_service_account-monitoring_viewer"
role = "roles/monitoring.viewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

resource "google_project_iam_member" "cluster_service_account-gcr" {
count = var.create_service_account && var.grant_registry_access ? 1 : 0
project = var.project_id
role = "roles/storage.objectViewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ variable "create_service_account" {
default = true
}

variable "grant_registry_access" {
type = bool
description = "Grants created cluster-specific service account storage.objectViewer role."
default = false
}

variable "service_account" {
type = string
description = "The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | bool | `"false"` | no |
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
| http\_load\_balancing | Enable httpload balancer addon | bool | `"true"` | no |
| identity\_namespace | Workload Identity namespace | string | `""` | no |
Expand Down
8 changes: 8 additions & 0 deletions modules/beta-public-cluster/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ resource "google_project_iam_member" "cluster_service_account-monitoring_viewer"
role = "roles/monitoring.viewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

resource "google_project_iam_member" "cluster_service_account-gcr" {
count = var.create_service_account && var.grant_registry_access ? 1 : 0
project = var.project_id
role = "roles/storage.objectViewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

6 changes: 6 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ variable "create_service_account" {
default = true
}

variable "grant_registry_access" {
type = bool
description = "Grants created cluster-specific service account storage.objectViewer role."
default = false
}

variable "service_account" {
type = string
description = "The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created."
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
| http\_load\_balancing | Enable httpload balancer addon | bool | `"true"` | no |
| initial\_node\_count | The number of nodes to create in this cluster's default node pool. | number | `"0"` | no |
Expand Down
8 changes: 8 additions & 0 deletions modules/private-cluster/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ resource "google_project_iam_member" "cluster_service_account-monitoring_viewer"
role = "roles/monitoring.viewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

resource "google_project_iam_member" "cluster_service_account-gcr" {
count = var.create_service_account && var.grant_registry_access ? 1 : 0
project = var.project_id
role = "roles/storage.objectViewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

6 changes: 6 additions & 0 deletions modules/private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ variable "create_service_account" {
default = true
}

variable "grant_registry_access" {
type = bool
description = "Grants created cluster-specific service account storage.objectViewer role."
default = false
}

variable "service_account" {
type = string
description = "The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created."
Expand Down
8 changes: 8 additions & 0 deletions sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ resource "google_project_iam_member" "cluster_service_account-monitoring_viewer"
role = "roles/monitoring.viewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

resource "google_project_iam_member" "cluster_service_account-gcr" {
count = var.create_service_account && var.grant_registry_access ? 1 : 0
project = var.project_id
role = "roles/storage.objectViewer"
member = "serviceAccount:${google_service_account.cluster_service_account[0].email}"
}

6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ variable "create_service_account" {
default = true
}

variable "grant_registry_access" {
type = bool
description = "Grants created cluster-specific service account storage.objectViewer role."
default = false
}

variable "service_account" {
type = string
description = "The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created."
Expand Down

0 comments on commit 0fca886

Please sign in to comment.