@@ -4,32 +4,43 @@ layout: "google"
44page_title : " Google: google_bigquery_default_service_account"
55sidebar_current : " docs-google-datasource-bigquery-default-service-account"
66description : |-
7- Retrieve default service account used by bigquery encryption in this project
7+ Get the email address of the project's BigQuery service account
88---
99
1010# google\_ bigquery\_ default\_ service\_ account
1111
12- Use this data source to retrieve default service account for this project
12+ Get the email address of a project's unique BigQuery service account.
13+
14+ Each Google Cloud project has a unique service account used by BigQuery. When using
15+ BigQuery with [ customer-managed encryption keys] ( https://cloud.google.com/bigquery/docs/customer-managed-encryption ) ,
16+ this account needs to be granted the
17+ ` cloudkms.cryptoKeyEncrypterDecrypter ` IAM role on the customer-managed Cloud KMS key used to protect the data.
18+
19+ For more information see
20+ [ the API reference] ( https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/getServiceAccount ) .
1321
1422## Example Usage
1523
1624``` hcl
17- data "google_bigquery_default_service_account" "default" { }
18-
19- output "default_account" {
20- value = "${data.google_bigquery_default_service_account.default.email}"
21- }
25+ data "google_bigquery_default_service_account" "bq_sa" {
26+ }
27+
28+ resource "google_kms_crypto_key_iam_member" "key_sa_user" {
29+ crypto_key_id = google_kms_crypto_key.key.id
30+ role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
31+ member = "serviceAccount:${data.google_bigquery_default_service_account.bq_sa.email}"
32+ }
2233```
2334
2435## Argument Reference
2536
2637The following arguments are supported:
2738
28- * ` project ` - (Optional) The project ID. If it is not provided, the provider project is used.
29-
39+ * ` project ` - (Optional) The project the unique service account was created for. If it is not provided, the provider project is used.
3040
3141## Attributes Reference
3242
3343The following attributes are exported:
3444
35- * ` email ` - Email address of the default service account used by bigquery encryption in this project
45+ * ` email ` - The email address of the service account. This value is often used to refer to the service account
46+ in order to grant IAM permissions.
0 commit comments