@@ -50,7 +50,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerBasicExample(t *testing.T)
5050 ResourceName : "google_data_loss_prevention_job_trigger.basic" ,
5151 ImportState : true ,
5252 ImportStateVerify : true ,
53- ImportStateVerifyIgnore : []string {"parent" },
53+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
5454 },
5555 },
5656 })
@@ -113,7 +113,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerBigqueryRowLimitExample(t
113113 ResourceName : "google_data_loss_prevention_job_trigger.bigquery_row_limit" ,
114114 ImportState : true ,
115115 ImportStateVerify : true ,
116- ImportStateVerifyIgnore : []string {"parent" },
116+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
117117 },
118118 },
119119 })
@@ -181,7 +181,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerBigqueryRowLimitPercentage
181181 ResourceName : "google_data_loss_prevention_job_trigger.bigquery_row_limit_percentage" ,
182182 ImportState : true ,
183183 ImportStateVerify : true ,
184- ImportStateVerifyIgnore : []string {"parent" },
184+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
185185 },
186186 },
187187 })
@@ -249,7 +249,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDataCatalogOutputExample(t
249249 ResourceName : "google_data_loss_prevention_job_trigger.data_catalog_output" ,
250250 ImportState : true ,
251251 ImportStateVerify : true ,
252- ImportStateVerifyIgnore : []string {"parent" },
252+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
253253 },
254254 },
255255 })
@@ -310,7 +310,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerSccOutputExample(t *testin
310310 ResourceName : "google_data_loss_prevention_job_trigger.scc_output" ,
311311 ImportState : true ,
312312 ImportStateVerify : true ,
313- ImportStateVerifyIgnore : []string {"parent" },
313+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
314314 },
315315 },
316316 })
@@ -371,7 +371,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerJobNotificationEmailsExamp
371371 ResourceName : "google_data_loss_prevention_job_trigger.job_notification_emails" ,
372372 ImportState : true ,
373373 ImportStateVerify : true ,
374- ImportStateVerifyIgnore : []string {"parent" },
374+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
375375 },
376376 },
377377 })
@@ -428,7 +428,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyExample(t *testi
428428 ResourceName : "google_data_loss_prevention_job_trigger.deidentify" ,
429429 ImportState : true ,
430430 ImportStateVerify : true ,
431- ImportStateVerifyIgnore : []string {"parent" },
431+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
432432 },
433433 },
434434 })
@@ -542,7 +542,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerHybridExample(t *testing.T
542542 ResourceName : "google_data_loss_prevention_job_trigger.hybrid_trigger" ,
543543 ImportState : true ,
544544 ImportStateVerify : true ,
545- ImportStateVerifyIgnore : []string {"parent" },
545+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
546546 },
547547 },
548548 })
@@ -610,7 +610,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspectExample(t *testing.
610610 ResourceName : "google_data_loss_prevention_job_trigger.inspect" ,
611611 ImportState : true ,
612612 ImportStateVerify : true ,
613- ImportStateVerifyIgnore : []string {"parent" },
613+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
614614 },
615615 },
616616 })
@@ -729,7 +729,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerPublishToStackdriverExampl
729729 ResourceName : "google_data_loss_prevention_job_trigger.publish_to_stackdriver" ,
730730 ImportState : true ,
731731 ImportStateVerify : true ,
732- ImportStateVerifyIgnore : []string {"parent" },
732+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
733733 },
734734 },
735735 })
@@ -765,6 +765,70 @@ resource "google_data_loss_prevention_job_trigger" "publish_to_stackdriver" {
765765` , context )
766766}
767767
768+ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerWithIdExample (t * testing.T ) {
769+ t .Parallel ()
770+
771+ context := map [string ]interface {}{
772+ "project" : acctest .GetTestProjectFromEnv (),
773+ "random_suffix" : RandString (t , 10 ),
774+ }
775+
776+ VcrTest (t , resource.TestCase {
777+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
778+ ProtoV5ProviderFactories : ProtoV5ProviderFactories (t ),
779+ CheckDestroy : testAccCheckDataLossPreventionJobTriggerDestroyProducer (t ),
780+ Steps : []resource.TestStep {
781+ {
782+ Config : testAccDataLossPreventionJobTrigger_dlpJobTriggerWithIdExample (context ),
783+ },
784+ {
785+ ResourceName : "google_data_loss_prevention_job_trigger.with_trigger_id" ,
786+ ImportState : true ,
787+ ImportStateVerify : true ,
788+ ImportStateVerifyIgnore : []string {"trigger_id" , "parent" },
789+ },
790+ },
791+ })
792+ }
793+
794+ func testAccDataLossPreventionJobTrigger_dlpJobTriggerWithIdExample (context map [string ]interface {}) string {
795+ return tpgresource .Nprintf (`
796+ resource "google_data_loss_prevention_job_trigger" "with_trigger_id" {
797+ parent = "projects/%{project}"
798+ description = "Starting description"
799+ display_name = "display"
800+ trigger_id = "tf-test-id-%{random_suffix}"
801+
802+ triggers {
803+ schedule {
804+ recurrence_period_duration = "86400s"
805+ }
806+ }
807+
808+ inspect_job {
809+ inspect_template_name = "fake"
810+ actions {
811+ save_findings {
812+ output_config {
813+ table {
814+ project_id = "project"
815+ dataset_id = "dataset123"
816+ }
817+ }
818+ }
819+ }
820+ storage_config {
821+ cloud_storage_options {
822+ file_set {
823+ url = "gs://mybucket/directory/"
824+ }
825+ }
826+ }
827+ }
828+ }
829+ ` , context )
830+ }
831+
768832func testAccCheckDataLossPreventionJobTriggerDestroyProducer (t * testing.T ) func (s * terraform.State ) error {
769833 return func (s * terraform.State ) error {
770834 for name , rs := range s .RootModule ().Resources {
0 commit comments