Skip to content
11 changes: 8 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
*****************************************/
data "google_compute_zones" "available" {
count = local.zone_count == 0 ? 1 : 0
}

provider = google
provider "google" {
project = "rare-style-447407-s1"
region = "us-central1"
}

project = var.project_id
region = local.region
provider "google-beta" {
project = "rare-style-447407-s1"
region = "us-central1"
}

resource "random_shuffle" "available_zones" {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ resource "google_project_iam_member" "cluster_service_account_node_service_accou
resource "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"
role = var.monitoring_metric_writer_role
member = google_service_account.cluster_service_account[0].member
}

Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -968,3 +968,9 @@ variable "fleet_project_grant_service_agent" {
type = bool
default = false
}

variable "monitoring_metric_writer_role" {
description = "The monitoring metrics writer role to assign to the GKE node service account"
type = string
default = "roles/monitoring.metricWriter"
}
1 change: 1 addition & 0 deletions terraform-google-kubernetes-engine
Submodule terraform-google-kubernetes-engine added at 70a28a
11 changes: 11 additions & 0 deletions test-implementation/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module "gke" {
source = "../modules/beta-private-cluster"
project_id = "rare-style-447407-s1"
name = "test-custom-role"
region = "us-central1"
network = "default"
subnetwork = "default"
ip_range_pods = "gke-pods"
ip_range_services = "gke-services"
monitoring_metric_writer_role = "projects/rare-style-447407-s1/roles/custom_metrics_writer"
}
Binary file added test-implementation/plan.tfplan
Binary file not shown.
Binary file added test-implementation/tfplan
Binary file not shown.
Loading