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

feat: Track the otel and stackdriver sa issue #134

Merged
merged 6 commits into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions modules/service_accounts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,25 @@ resource "google_service_account" "workload-identity-user-sa" {
count = var.enable_stackdriver == true ? 1 : 0
account_id = "stackdriver"
display_name = "Service Account For Workload Identity"

}

resource "google_project_iam_member" "monitoring-role" {
count = var.enable_stackdriver == true ? 1 : 0
project = local.project_id
role = "roles/monitoring.viewer"
member = "serviceAccount:${google_service_account.workload-identity-user-sa[count.index].email}"
member = "serviceAccount:${google_service_account.workload-identity-user-sa[count.index].email}"
}

resource "google_service_account_iam_member" "monitoring-role" {
count = var.enable_stackdriver == true ? 1 : 0
service_account_id = google_service_account.workload-identity-user-sa[count.index].id
role = "roles/iam.serviceAccountTokenCreator"
member = "serviceAccount:${google_service_account.workload-identity-user-sa[count.index].email}"
}

resource "google_project_iam_member" "workload_identity-role" {
resource "google_service_account_iam_member" "workload_identity-role" {
count = var.enable_stackdriver == true ? 1 : 0
project = local.project_id
service_account_id = google_service_account.workload-identity-user-sa[count.index].id
role = "roles/iam.workloadIdentityUser"
member = "serviceAccount:${local.project_id}.svc.id.goog[default/${var.service_account_name}]"
}
Loading