Skip to content

Commit 6606a4d

Browse files
inspect_template_name changed from required to optional (#8036) (#14845)
* inspect_template_name changed to optional from required * changed random string func and config in test Signed-off-by: Modular Magician <[email protected]>
1 parent 7ec7299 commit 6606a4d

File tree

4 files changed

+89
-6
lines changed

4 files changed

+89
-6
lines changed

.changelog/8036.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
dlp: changed `inspect_template_name` field from required to optional in `google_data_loss_prevention_job_trigger` resource
3+
```

google/resource_data_loss_prevention_job_trigger_test.go

+80
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,50 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerActionsOptionalExample(t *
435435
})
436436
}
437437

438+
func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalExample(t *testing.T) {
439+
t.Parallel()
440+
441+
context := map[string]interface{}{
442+
"project": acctest.GetTestProjectFromEnv(),
443+
"random_suffix": RandString(t, 10),
444+
}
445+
446+
VcrTest(t, resource.TestCase{
447+
PreCheck: func() { acctest.AccTestPreCheck(t) },
448+
ProtoV5ProviderFactories: ProtoV5ProviderFactories(t),
449+
CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t),
450+
Steps: []resource.TestStep{
451+
{
452+
Config: testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context),
453+
},
454+
{
455+
ResourceName: "google_data_loss_prevention_job_trigger.basic",
456+
ImportState: true,
457+
ImportStateVerify: true,
458+
ImportStateVerifyIgnore: []string{"parent"},
459+
},
460+
{
461+
Config: testAccDataLossPreventionJobTrigger_dlpJobTriggerBasic(context),
462+
},
463+
{
464+
ResourceName: "google_data_loss_prevention_job_trigger.basic",
465+
ImportState: true,
466+
ImportStateVerify: true,
467+
ImportStateVerifyIgnore: []string{"parent"},
468+
},
469+
{
470+
Config: testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context),
471+
},
472+
{
473+
ResourceName: "google_data_loss_prevention_job_trigger.basic",
474+
ImportState: true,
475+
ImportStateVerify: true,
476+
ImportStateVerifyIgnore: []string{"parent"},
477+
},
478+
},
479+
})
480+
}
481+
438482
func testAccDataLossPreventionJobTrigger_dlpJobTriggerBasic(context map[string]interface{}) string {
439483
return Nprintf(`
440484
resource "google_data_loss_prevention_job_trigger" "basic" {
@@ -2273,3 +2317,39 @@ resource "google_data_loss_prevention_job_trigger" "basic" {
22732317
}
22742318
`, context)
22752319
}
2320+
2321+
func testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context map[string]interface{}) string {
2322+
return Nprintf(`
2323+
resource "google_data_loss_prevention_job_trigger" "basic" {
2324+
parent = "projects/%{project}"
2325+
description = "Starting description"
2326+
display_name = "display"
2327+
2328+
triggers {
2329+
schedule {
2330+
recurrence_period_duration = "86400s"
2331+
}
2332+
}
2333+
2334+
inspect_job {
2335+
actions {
2336+
save_findings {
2337+
output_config {
2338+
table {
2339+
project_id = "project"
2340+
dataset_id = "dataset123"
2341+
}
2342+
}
2343+
}
2344+
}
2345+
storage_config {
2346+
cloud_storage_options {
2347+
file_set {
2348+
url = "gs://mybucket/directory/"
2349+
}
2350+
}
2351+
}
2352+
}
2353+
}
2354+
`, context)
2355+
}

google/services/datalossprevention/resource_data_loss_prevention_job_trigger.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ A duration in seconds with up to nine fractional digits, terminated by 's'. Exam
112112
MaxItems: 1,
113113
Elem: &schema.Resource{
114114
Schema: map[string]*schema.Schema{
115-
"inspect_template_name": {
116-
Type: schema.TypeString,
117-
Required: true,
118-
Description: `The name of the template to run when this job is triggered.`,
119-
},
120115
"storage_config": {
121116
Type: schema.TypeList,
122117
Required: true,
@@ -1275,6 +1270,11 @@ at https://cloud.google.com/dlp/docs/infotypes-reference when specifying a built
12751270
},
12761271
},
12771272
},
1273+
"inspect_template_name": {
1274+
Type: schema.TypeString,
1275+
Optional: true,
1276+
Description: `The name of the template to run when this job is triggered.`,
1277+
},
12781278
},
12791279
},
12801280
},

website/docs/r/data_loss_prevention_job_trigger.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ The following arguments are supported:
496496
<a name="nested_inspect_job"></a>The `inspect_job` block supports:
497497

498498
* `inspect_template_name` -
499-
(Required)
499+
(Optional)
500500
The name of the template to run when this job is triggered.
501501

502502
* `inspect_config` -

0 commit comments

Comments
 (0)