Skip to content

Commit 4158af5

Browse files
Removed required tag on maxFindingsPerInfoType.infoType (#10818) (#18285)
[upstream:f630747146b8a3ad8adc6b775abfb311de9401d8] Signed-off-by: Modular Magician <[email protected]>
1 parent 7798433 commit 4158af5

3 files changed

+87
-7
lines changed

google/services/datalossprevention/resource_data_loss_prevention_inspect_template.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,14 @@ at https://cloud.google.com/dlp/docs/infotypes-reference when specifying a built
336336
Description: `Configuration of findings limit given for specified infoTypes.`,
337337
Elem: &schema.Resource{
338338
Schema: map[string]*schema.Schema{
339+
"max_findings": {
340+
Type: schema.TypeInt,
341+
Required: true,
342+
Description: `Max findings limit for the given infoType.`,
343+
},
339344
"info_type": {
340345
Type: schema.TypeList,
341-
Required: true,
346+
Optional: true,
342347
Description: `Type of information the findings limit applies to. Only one limit per infoType should be provided. If InfoTypeLimit does
343348
not have an infoType, the DLP API applies the limit against all infoTypes that are found but not
344349
specified in another InfoTypeLimit.`,
@@ -375,11 +380,6 @@ at https://cloud.google.com/dlp/docs/infotypes-reference when specifying a built
375380
},
376381
},
377382
},
378-
"max_findings": {
379-
Type: schema.TypeInt,
380-
Required: true,
381-
Description: `Max findings limit for the given infoType.`,
382-
},
383383
},
384384
},
385385
},

google/services/datalossprevention/resource_data_loss_prevention_inspect_template_generated_test.go

+53
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,59 @@ resource "google_data_loss_prevention_inspect_template" "with_template_id" {
428428
`, context)
429429
}
430430

431+
func TestAccDataLossPreventionInspectTemplate_dlpInspectTemplateMaxInfotypePerFindingDefaultExample(t *testing.T) {
432+
t.Parallel()
433+
434+
context := map[string]interface{}{
435+
"project": envvar.GetTestProjectFromEnv(),
436+
"random_suffix": acctest.RandString(t, 10),
437+
}
438+
439+
acctest.VcrTest(t, resource.TestCase{
440+
PreCheck: func() { acctest.AccTestPreCheck(t) },
441+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
442+
CheckDestroy: testAccCheckDataLossPreventionInspectTemplateDestroyProducer(t),
443+
Steps: []resource.TestStep{
444+
{
445+
Config: testAccDataLossPreventionInspectTemplate_dlpInspectTemplateMaxInfotypePerFindingDefaultExample(context),
446+
},
447+
{
448+
ResourceName: "google_data_loss_prevention_inspect_template.max_infotype_per_finding_default",
449+
ImportState: true,
450+
ImportStateVerify: true,
451+
ImportStateVerifyIgnore: []string{"parent", "template_id"},
452+
},
453+
},
454+
})
455+
}
456+
457+
func testAccDataLossPreventionInspectTemplate_dlpInspectTemplateMaxInfotypePerFindingDefaultExample(context map[string]interface{}) string {
458+
return acctest.Nprintf(`
459+
resource "google_data_loss_prevention_inspect_template" "max_infotype_per_finding_default" {
460+
parent = "projects/%{project}"
461+
462+
inspect_config {
463+
info_types {
464+
name = "EMAIL_ADDRESS"
465+
}
466+
info_types {
467+
name = "PERSON_NAME"
468+
}
469+
470+
min_likelihood = "UNLIKELY"
471+
limits {
472+
max_findings_per_request = 333
473+
max_findings_per_item = 222
474+
max_findings_per_info_type {
475+
# Entry with no info_type specifies the default value used by all info_types that don't specify their own limit
476+
max_findings = 111
477+
}
478+
}
479+
}
480+
}
481+
`, context)
482+
}
483+
431484
func testAccCheckDataLossPreventionInspectTemplateDestroyProducer(t *testing.T) func(s *terraform.State) error {
432485
return func(s *terraform.State) error {
433486
for name, rs := range s.RootModule().Resources {

website/docs/r/data_loss_prevention_inspect_template.html.markdown

+28-1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,33 @@ resource "google_data_loss_prevention_inspect_template" "custom_type_surrogate"
269269
}
270270
}
271271
```
272+
## Example Usage - Dlp Inspect Template Max Infotype Per Finding Default
273+
274+
275+
```hcl
276+
resource "google_data_loss_prevention_inspect_template" "max_infotype_per_finding_default" {
277+
parent = "projects/my-project-name"
278+
279+
inspect_config {
280+
info_types {
281+
name = "EMAIL_ADDRESS"
282+
}
283+
info_types {
284+
name = "PERSON_NAME"
285+
}
286+
287+
min_likelihood = "UNLIKELY"
288+
limits {
289+
max_findings_per_request = 333
290+
max_findings_per_item = 222
291+
max_findings_per_info_type {
292+
# Entry with no info_type specifies the default value used by all info_types that don't specify their own limit
293+
max_findings = 111
294+
}
295+
}
296+
}
297+
}
298+
```
272299

273300
## Argument Reference
274301

@@ -372,7 +399,7 @@ The following arguments are supported:
372399
<a name="nested_max_findings_per_info_type"></a>The `max_findings_per_info_type` block supports:
373400

374401
* `info_type` -
375-
(Required)
402+
(Optional)
376403
Type of information the findings limit applies to. Only one limit per infoType should be provided. If InfoTypeLimit does
377404
not have an infoType, the DLP API applies the limit against all infoTypes that are found but not
378405
specified in another InfoTypeLimit.

0 commit comments

Comments
 (0)