-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added job_notification_emails and deidentify actions in google_data_l…
…oss_prevention_job_trigger (#7687) * Added job_notification_emails and deidentify actions in google_data_loss_prevention_job_trigger * Updated the deidentify actions enum and added update tests for deidentify action
- Loading branch information
1 parent
636581c
commit 943e8d4
Showing
4 changed files
with
514 additions
and
0 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
83 changes: 83 additions & 0 deletions
83
mmv1/templates/terraform/examples/dlp_job_trigger_deidentify.tf.erb
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,83 @@ | ||
resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { | ||
parent = "projects/<%= ctx[:test_env_vars]['project'] %>" | ||
description = "Description for the job_trigger created by terraform" | ||
display_name = "TerraformDisplayName" | ||
|
||
triggers { | ||
schedule { | ||
recurrence_period_duration = "86400s" | ||
} | ||
} | ||
|
||
inspect_job { | ||
inspect_template_name = "sample-inspect-template" | ||
actions { | ||
deidentify { | ||
cloud_storage_output = "gs://samplebucket/dir/" | ||
file_types_to_transform = ["CSV", "TSV"] | ||
transformation_details_storage_config { | ||
table { | ||
project_id = "<%= ctx[:test_env_vars]['project'] %>" | ||
dataset_id = google_bigquery_dataset.default.dataset_id | ||
table_id = google_bigquery_table.default.table_id | ||
} | ||
} | ||
transformation_config { | ||
deidentify_template = "sample-deidentify-template" | ||
image_redact_template = "sample-image-redact-template" | ||
structured_deidentify_template = "sample-structured-deidentify-template" | ||
} | ||
} | ||
} | ||
storage_config { | ||
cloud_storage_options { | ||
file_set { | ||
url = "gs://mybucket/directory/" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "google_bigquery_dataset" "default" { | ||
dataset_id = "<%= ctx[:vars]['name'] %>" | ||
friendly_name = "terraform-test" | ||
description = "Description for the dataset created by terraform" | ||
location = "US" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
} | ||
|
||
resource "google_bigquery_table" "default" { | ||
dataset_id = google_bigquery_dataset.default.dataset_id | ||
table_id = "<%= ctx[:vars]['name'] %>" | ||
deletion_protection = false | ||
|
||
time_partitioning { | ||
type = "DAY" | ||
} | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
|
||
schema = <<EOF | ||
[ | ||
{ | ||
"name": "quantity", | ||
"type": "NUMERIC", | ||
"mode": "NULLABLE", | ||
"description": "The quantity" | ||
}, | ||
{ | ||
"name": "name", | ||
"type": "STRING", | ||
"mode": "NULLABLE", | ||
"description": "Name of the object" | ||
} | ||
] | ||
EOF | ||
} |
25 changes: 25 additions & 0 deletions
25
mmv1/templates/terraform/examples/dlp_job_trigger_job_notification_emails.tf.erb
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,25 @@ | ||
resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" { | ||
parent = "projects/<%= ctx[:test_env_vars]['project'] %>" | ||
description = "Description for the job_trigger created by terraform" | ||
display_name = "TerraformDisplayName" | ||
|
||
triggers { | ||
schedule { | ||
recurrence_period_duration = "86400s" | ||
} | ||
} | ||
|
||
inspect_job { | ||
inspect_template_name = "sample-inspect-template" | ||
actions { | ||
job_notification_emails {} | ||
} | ||
storage_config { | ||
cloud_storage_options { | ||
file_set { | ||
url = "gs://mybucket/directory/" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.