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

Requesting the ability to add a custom monitoring metrics writer role to GKE node service account #2073

Open
pavankrishna5 opened this issue Sep 9, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers triaged Scoped and ready for work

Comments

@pavankrishna5
Copy link

TL;DR

Currently, the GKE module is assigning a monitoring metrics writer role as a default to the GKE node service account. I am requesting the ability to add a custom role than the default role: metrics writer role

Terraform Resources

IAM role for GKE node service account created here:
https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/master/modules/beta-private-cluster/sa.tf#L59

 "google_project_iam_member" "cluster_service_account-metric_writer" {
  count   = var.create_service_account ? 1 : 0
  project = google_service_account.cluster_service_account[0].project
  role    = "roles/monitoring.metricWriter"
  member  = google_service_account.cluster_service_account[0].member
}

Detailed design

Create a new variable, monitoring_metric_writer_role and set it to the default value: roles/monitoring.metricWriter. Use the variable in the role section in the code block like this:

 "google_project_iam_member" "cluster_service_account-metric_writer" {
  count   = var.create_service_account ? 1 : 0
  project = google_service_account.cluster_service_account[0].project
  role    = var.monitoring_metric_writer_role
  member  = google_service_account.cluster_service_account[0].member
}

variable "monitoring_metric_writer_role" {
  type        = string
  description = "custom monitoring metrics writer role in case there is any"
  default     = "roles/monitoring.metricWriter"
}

Additional information

Few organization restricts using the role available, and may restrict the user to use a specific role instead of the default role.

@pavankrishna5 pavankrishna5 added the enhancement New feature or request label Sep 9, 2024
@apeabody apeabody added triaged Scoped and ready for work good first issue Good for newcomers labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers triaged Scoped and ready for work
Projects
None yet
Development

No branches or pull requests

2 participants