Skip to content

Commit

Permalink
Add two outputs for dlp job trigger: outputting to SCC and DataCatalog (
Browse files Browse the repository at this point in the history
#6855)

Co-authored-by: Shuya Ma <87669292+shuyama1@users.noreply.github.com>
Fixes hashicorp/terraform-provider-google#11861
  • Loading branch information
Wallace99 authored Jan 24, 2023
1 parent 59cc595 commit c98f227
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 1 deletion.
30 changes: 29 additions & 1 deletion mmv1/products/dlp/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,10 @@ objects:
exactly_one_of:
- save_findings
- pub_sub
- publish_findings_to_cloud_data_catalog
- publish_summary_to_cscc
description: |
Schedule for triggered jobs
If set, the detailed findings will be persisted to the specified OutputStorageConfig. Only a single instance of this action can be specified. Compatible with: Inspect, Risk
properties:
- !ruby/object:Api::Type::NestedObject
name: 'outputConfig'
Expand Down Expand Up @@ -385,6 +387,8 @@ objects:
exactly_one_of:
- save_findings
- pub_sub
- publish_findings_to_cloud_data_catalog
- publish_summary_to_cscc
description: |
Publish a message into a given Pub/Sub topic when the job completes.
properties:
Expand All @@ -393,6 +397,30 @@ objects:
required: true
description: |
Cloud Pub/Sub topic to send notifications to.
- !ruby/object:Api::Type::NestedObject
name: 'publishSummaryToCscc'
exactly_one_of:
- save_findings
- pub_sub
- publish_findings_to_cloud_data_catalog
- publish_summary_to_cscc
allow_empty_object: true
send_empty_value: true
properties: [ ]
description: |
Publish the result summary of a DlpJob to the Cloud Security Command Center.
- !ruby/object:Api::Type::NestedObject
name: 'publishFindingsToCloudDataCatalog'
exactly_one_of:
- save_findings
- pub_sub
- publish_findings_to_cloud_data_catalog
- publish_summary_to_cscc
allow_empty_object: true
send_empty_value: true
properties: [ ]
description: |
Publish findings of a DlpJob to Data Catalog.
- !ruby/object:Api::Resource
name: 'InspectTemplate'
create_url: "{{parent}}/inspectTemplates"
Expand Down
16 changes: 16 additions & 0 deletions mmv1/products/dlp/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ overrides: !ruby/object:Overrides::ResourceOverrides
trigger: "trigger"
test_env_vars:
project: :PROJECT_NAME
- !ruby/object:Provider::Terraform::Examples
name: "dlp_job_trigger_data_catalog_output"
primary_resource_id: "data_catalog_output"
vars:
trigger: "trigger"
test_env_vars:
project: :PROJECT_NAME
skip_docs: true
- !ruby/object:Provider::Terraform::Examples
name: "dlp_job_trigger_scc_output"
primary_resource_id: "scc_output"
vars:
trigger: "trigger"
test_env_vars:
project: :PROJECT_NAME
skip_docs: true
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: templates/terraform/encoders/wrap_object.go.erb
custom_import: templates/terraform/custom_import/dlp_import.go.erb
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" {
parent = "projects/<%= ctx[:test_env_vars]['project'] %>"
description = "Description"
display_name = "Displayname"

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

inspect_job {
inspect_template_name = "fake"
actions {
publish_findings_to_cloud_data_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
@@ -0,0 +1,30 @@
resource "google_data_loss_prevention_job_trigger" "<%= ctx[:primary_resource_id] %>" {
parent = "projects/<%= ctx[:test_env_vars]['project'] %>"
description = "Description"
display_name = "Displayname"

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

inspect_job {
inspect_template_name = "fake"
actions {
publish_summary_to_cscc {
}
}
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"
}
}
}
}

0 comments on commit c98f227

Please sign in to comment.