@@ -50,7 +50,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerBasicExample(t *testing.T)
50
50
ResourceName : "google_data_loss_prevention_job_trigger.basic" ,
51
51
ImportState : true ,
52
52
ImportStateVerify : true ,
53
- ImportStateVerifyIgnore : []string {"parent" },
53
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
54
54
},
55
55
},
56
56
})
@@ -113,7 +113,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerBigqueryRowLimitExample(t
113
113
ResourceName : "google_data_loss_prevention_job_trigger.bigquery_row_limit" ,
114
114
ImportState : true ,
115
115
ImportStateVerify : true ,
116
- ImportStateVerifyIgnore : []string {"parent" },
116
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
117
117
},
118
118
},
119
119
})
@@ -181,7 +181,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerBigqueryRowLimitPercentage
181
181
ResourceName : "google_data_loss_prevention_job_trigger.bigquery_row_limit_percentage" ,
182
182
ImportState : true ,
183
183
ImportStateVerify : true ,
184
- ImportStateVerifyIgnore : []string {"parent" },
184
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
185
185
},
186
186
},
187
187
})
@@ -249,7 +249,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDataCatalogOutputExample(t
249
249
ResourceName : "google_data_loss_prevention_job_trigger.data_catalog_output" ,
250
250
ImportState : true ,
251
251
ImportStateVerify : true ,
252
- ImportStateVerifyIgnore : []string {"parent" },
252
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
253
253
},
254
254
},
255
255
})
@@ -310,7 +310,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerSccOutputExample(t *testin
310
310
ResourceName : "google_data_loss_prevention_job_trigger.scc_output" ,
311
311
ImportState : true ,
312
312
ImportStateVerify : true ,
313
- ImportStateVerifyIgnore : []string {"parent" },
313
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
314
314
},
315
315
},
316
316
})
@@ -371,7 +371,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerJobNotificationEmailsExamp
371
371
ResourceName : "google_data_loss_prevention_job_trigger.job_notification_emails" ,
372
372
ImportState : true ,
373
373
ImportStateVerify : true ,
374
- ImportStateVerifyIgnore : []string {"parent" },
374
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
375
375
},
376
376
},
377
377
})
@@ -428,7 +428,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyExample(t *testi
428
428
ResourceName : "google_data_loss_prevention_job_trigger.deidentify" ,
429
429
ImportState : true ,
430
430
ImportStateVerify : true ,
431
- ImportStateVerifyIgnore : []string {"parent" },
431
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
432
432
},
433
433
},
434
434
})
@@ -542,7 +542,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerHybridExample(t *testing.T
542
542
ResourceName : "google_data_loss_prevention_job_trigger.hybrid_trigger" ,
543
543
ImportState : true ,
544
544
ImportStateVerify : true ,
545
- ImportStateVerifyIgnore : []string {"parent" },
545
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
546
546
},
547
547
},
548
548
})
@@ -610,7 +610,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspectExample(t *testing.
610
610
ResourceName : "google_data_loss_prevention_job_trigger.inspect" ,
611
611
ImportState : true ,
612
612
ImportStateVerify : true ,
613
- ImportStateVerifyIgnore : []string {"parent" },
613
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
614
614
},
615
615
},
616
616
})
@@ -729,7 +729,7 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerPublishToStackdriverExampl
729
729
ResourceName : "google_data_loss_prevention_job_trigger.publish_to_stackdriver" ,
730
730
ImportState : true ,
731
731
ImportStateVerify : true ,
732
- ImportStateVerifyIgnore : []string {"parent" },
732
+ ImportStateVerifyIgnore : []string {"trigger_id" , " parent" },
733
733
},
734
734
},
735
735
})
@@ -765,6 +765,70 @@ resource "google_data_loss_prevention_job_trigger" "publish_to_stackdriver" {
765
765
` , context )
766
766
}
767
767
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
+
768
832
func testAccCheckDataLossPreventionJobTriggerDestroyProducer (t * testing.T ) func (s * terraform.State ) error {
769
833
return func (s * terraform.State ) error {
770
834
for name , rs := range s .RootModule ().Resources {
0 commit comments