-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3ff940
commit 0c3b3fd
Showing
4 changed files
with
47 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,40 @@ | ||
resource "google_service_account" "this" { | ||
|
||
account_id = "observe-collect" | ||
account_id = "terraform-observe-collect-sa" | ||
description = "Used to set up collection" | ||
project = var.project | ||
} | ||
|
||
# Grant yourself the Service Token Creator Role | ||
resource "google_service_account_iam_member" "sa_token_creator_role" { | ||
service_account_id = google_service_account.this.name | ||
role = "roles/iam.serviceAccountTokenCreator" | ||
member = "user:${var.current_user}" | ||
} | ||
|
||
############### | ||
# | ||
# Uncomment the first section for a service account that can deploy to a project | ||
# and uncomment the second section for folder collection. If you are deploying to | ||
# a folder, you need to add the folder id to the service_account.auto.tfvars file as well. | ||
# | ||
# | ||
# The default is to use a project | ||
|
||
################ | ||
|
||
# resource "google_project_iam_member" "this" { | ||
# for_each = var.project_collection_roles | ||
resource "google_project_iam_member" "this" { | ||
for_each = var.project_collection_roles | ||
|
||
# project = var.project | ||
# role = each.key | ||
# member = "serviceAccount:${google_service_account.this.email}" | ||
# } | ||
project = var.project | ||
role = each.key | ||
member = "serviceAccount:${google_service_account.this.email}" | ||
} | ||
|
||
# resource "google_folder_iam_member" "this" { | ||
# for_each = var.folder_collection_roles | ||
|
||
# folder = var.folder | ||
# role = each.key | ||
# member = "serviceAccount:${google_service_account.this.email}" | ||
# } | ||
# } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
output "service_account" { | ||
value = google_service_account.this | ||
value = google_service_account.this | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
project = "my_project_id" | ||
# folder ="my_folder_id" #uncomment for folder collection | ||
project = "my_project_id" | ||
# folder ="my_folder_id" #uncomment for folder collection | ||
current_user = "[email protected]" #Get via gcloud config get-value account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters