Skip to content
Open
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions mmv1/products/dlp/JobTrigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ examples:
trigger: 'trigger'
test_env_vars:
project: 'PROJECT_NAME'
- name: 'dlp_job_trigger_publish_to_dataplex_catalog'
primary_resource_id: 'publish_to_dataplex_catalog'
vars:
trigger: 'trigger'
test_env_vars:
project: 'PROJECT_NAME'
exclude_docs: true
- name: 'dlp_job_trigger_data_catalog_output'
primary_resource_id: 'data_catalog_output'
vars:
Expand Down Expand Up @@ -1067,6 +1074,7 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand Down Expand Up @@ -1140,6 +1148,7 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand All @@ -1162,6 +1171,25 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
# - deidentify
# - publish_to_stackdriver
allow_empty_object: true
properties:
[]
- name: 'publishFindingsToDataplexCatalog'
type: NestedObject
description: |
Publish findings of a DlpJob as an aspect to Dataplex Universal Catalog.
send_empty_value: true
# TODO: uncomment here once they are supported(github.com/hashicorp/terraform-plugin-sdk/issues/470)
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand All @@ -1179,6 +1207,7 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand All @@ -1196,6 +1225,7 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand All @@ -1210,6 +1240,7 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand Down Expand Up @@ -1302,6 +1333,7 @@ properties:
# exactly_one_of:
# - save_findings
# - pub_sub
# - publish_findings_to_dataplex_catalog
# - publish_findings_to_cloud_data_catalog
# - publish_summary_to_cscc
# - job_notification_emails
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "google_data_loss_prevention_job_trigger" "{{$.PrimaryResourceId}}" {
parent = "projects/{{index $.TestEnvVars "project"}}"
description = "Description"
display_name = "Displayname"

triggers {
schedule {
recurrence_period_duration = "86400s"
}
}

inspect_job {
inspect_template_name = "fake"
actions {
publish_findings_to_dataplex_catalog {
}
}
storage_config {
big_query_options {
table_reference {
project_id = "project"
dataset_id = "dataset"
table_id = "table_to_scan"
}
rows_limit_percent = 50
sample_method = "RANDOM_START"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,31 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerPubsub(t *testing.T) {
})
}

func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDataplexCatalog(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project": envvar.GetTestProjectFromEnv(),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccDataLossPreventionJobTrigger_publishFindingsToDataplexCatalog(context),
},
{
ResourceName: "google_data_loss_prevention_job_trigger.actions",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
},
},
})
}

func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyUpdate(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -919,6 +944,43 @@ resource "google_data_loss_prevention_job_trigger" "pubsub" {
`, context)
}

func testAccDataLossPreventionJobTrigger_publishFindingsToDataplexCatalog(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_data_loss_prevention_job_trigger" "actions" {
parent = "projects/%{project}"
description = "Starting description"
display_name = "display"

triggers {
schedule {
recurrence_period_duration = "86400s"
}
}

inspect_job {
inspect_template_name = "fake"
actions {
publish_findings_to_dataplex_catalog {}
}
storage_config {
big_query_options {
table_reference {
project_id = "project"
dataset_id = "dataset"
table_id = "table_to_scan"
}
rows_limit = 1000
sample_method = "RANDOM_START"
identifying_fields {
name = "field"
}
}
}
}
}
`, context)
}

func testAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyBasic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_data_loss_prevention_job_trigger" "actions" {
Expand Down
Loading