-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2409 from ameukam/bigquery-transfer-artificats-gc…
…slogs Transfer Bigquery dataset to k8s-infra-public-pii
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
infra/gcp/clusters/projects/k8s-infra-public-pii/bigquery.tf
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
// Service account dedicated for BigQuery Data Transfer | ||
resource "google_service_account" "bq_data_transfer_writer" { | ||
account_id = "bq-data-transfer" | ||
description = "Service Acccount BigQuery Data Transfer" | ||
} | ||
|
||
// grant bigquery dataEditor role to the service account so that scheduled query can run | ||
resource "google_project_iam_member" "bq_data_transfer_writer_binding" { | ||
project = google_project.project.project_id | ||
role = "roles/bigquery.dataEditor" | ||
member = "serviceAccount:${google_service_account.bq_data_transfer_writer.email}" | ||
} | ||
|
||
resource "google_bigquery_data_transfer_config" "bq_data_transfer" { | ||
display_name = "BigQuey data transfer to ${google_bigquery_dataset.audit-logs-gcs.dataset_id}" | ||
project = google_project.project.project_id | ||
data_source_id = "k8s-infra-ii-sandbox.riaan_data_store" | ||
schedule = "every 24 hours" #Times are in UTC | ||
destination_dataset_id = google_bigquery_dataset.audit-logs-gcs.dataset_id | ||
service_account_name = google_service_account.bq_data_transfer_writer.email | ||
|
||
params = { | ||
write_disposition = "WRITE_TRUNCATE" #Overwrite existing data | ||
} | ||
|
||
schedule_options { | ||
start_time = "15h00" #in UTC | ||
} | ||
|
||
email_preferences { | ||
enable_failure_email = true | ||
} | ||
} |