diff --git a/autogen/main/sa.tf.tmpl b/autogen/main/sa.tf.tmpl index a775fbe6af..f38e3a8687 100644 --- a/autogen/main/sa.tf.tmpl +++ b/autogen/main/sa.tf.tmpl @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/beta-autopilot-private-cluster/sa.tf b/modules/beta-autopilot-private-cluster/sa.tf index 6c6e1f663b..fe36dadd32 100644 --- a/modules/beta-autopilot-private-cluster/sa.tf +++ b/modules/beta-autopilot-private-cluster/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/beta-autopilot-public-cluster/sa.tf b/modules/beta-autopilot-public-cluster/sa.tf index 6c6e1f663b..fe36dadd32 100644 --- a/modules/beta-autopilot-public-cluster/sa.tf +++ b/modules/beta-autopilot-public-cluster/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/beta-private-cluster-update-variant/sa.tf b/modules/beta-private-cluster-update-variant/sa.tf index 6c6e1f663b..fe36dadd32 100644 --- a/modules/beta-private-cluster-update-variant/sa.tf +++ b/modules/beta-private-cluster-update-variant/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/beta-private-cluster/sa.tf b/modules/beta-private-cluster/sa.tf index 6c6e1f663b..fe36dadd32 100644 --- a/modules/beta-private-cluster/sa.tf +++ b/modules/beta-private-cluster/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/beta-public-cluster-update-variant/sa.tf b/modules/beta-public-cluster-update-variant/sa.tf index 6c6e1f663b..fe36dadd32 100644 --- a/modules/beta-public-cluster-update-variant/sa.tf +++ b/modules/beta-public-cluster-update-variant/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/beta-public-cluster/sa.tf b/modules/beta-public-cluster/sa.tf index 6c6e1f663b..fe36dadd32 100644 --- a/modules/beta-public-cluster/sa.tf +++ b/modules/beta-public-cluster/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/private-cluster-update-variant/sa.tf b/modules/private-cluster-update-variant/sa.tf index 6f89899bee..da1930c7b3 100644 --- a/modules/private-cluster-update-variant/sa.tf +++ b/modules/private-cluster-update-variant/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/modules/private-cluster/sa.tf b/modules/private-cluster/sa.tf index 6f89899bee..da1930c7b3 100644 --- a/modules/private-cluster/sa.tf +++ b/modules/private-cluster/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key diff --git a/sa.tf b/sa.tf index 6f89899bee..da1930c7b3 100644 --- a/sa.tf +++ b/sa.tf @@ -52,6 +52,20 @@ resource "google_project_iam_member" "cluster_service_account-nodeService_accoun member = google_service_account.cluster_service_account[0].member } +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" + member = google_service_account.cluster_service_account[0].member +} + +resource "google_project_iam_member" "cluster_service_account-resourceMetadata-writer" { + count = var.create_service_account ? 1 : 0 + project = google_service_account.cluster_service_account[0].project + role = "roles/stackdriver.resourceMetadata.writer" + member = google_service_account.cluster_service_account[0].member +} + resource "google_project_iam_member" "cluster_service_account-gcr" { for_each = var.create_service_account && var.grant_registry_access ? toset(local.registry_projects_list) : [] project = each.key