Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect_template_name changed from required to optional #14845

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/8036.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
dlp: changed `inspect_template_name` field from required to optional in `google_data_loss_prevention_job_trigger` resource
```
80 changes: 80 additions & 0 deletions google/resource_data_loss_prevention_job_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,50 @@ func TestAccDataLossPreventionJobTrigger_dlpJobTriggerActionsOptionalExample(t *
})
}

func TestAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project": acctest.GetTestProjectFromEnv(),
"random_suffix": RandString(t, 10),
}

VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckDataLossPreventionJobTriggerDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context),
},
{
ResourceName: "google_data_loss_prevention_job_trigger.basic",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
},
{
Config: testAccDataLossPreventionJobTrigger_dlpJobTriggerBasic(context),
},
{
ResourceName: "google_data_loss_prevention_job_trigger.basic",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
},
{
Config: testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context),
},
{
ResourceName: "google_data_loss_prevention_job_trigger.basic",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"parent"},
},
},
})
}

func testAccDataLossPreventionJobTrigger_dlpJobTriggerBasic(context map[string]interface{}) string {
return Nprintf(`
resource "google_data_loss_prevention_job_trigger" "basic" {
Expand Down Expand Up @@ -2273,3 +2317,39 @@ resource "google_data_loss_prevention_job_trigger" "basic" {
}
`, context)
}

func testAccDataLossPreventionJobTrigger_dlpJobTriggerInspectOptionalBasic(context map[string]interface{}) string {
return Nprintf(`
resource "google_data_loss_prevention_job_trigger" "basic" {
parent = "projects/%{project}"
description = "Starting description"
display_name = "display"

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

inspect_job {
actions {
save_findings {
output_config {
table {
project_id = "project"
dataset_id = "dataset123"
}
}
}
}
storage_config {
cloud_storage_options {
file_set {
url = "gs://mybucket/directory/"
}
}
}
}
}
`, context)
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ A duration in seconds with up to nine fractional digits, terminated by 's'. Exam
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"inspect_template_name": {
Type: schema.TypeString,
Required: true,
Description: `The name of the template to run when this job is triggered.`,
},
"storage_config": {
Type: schema.TypeList,
Required: true,
Expand Down Expand Up @@ -1275,6 +1270,11 @@ at https://cloud.google.com/dlp/docs/infotypes-reference when specifying a built
},
},
},
"inspect_template_name": {
Type: schema.TypeString,
Optional: true,
Description: `The name of the template to run when this job is triggered.`,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ The following arguments are supported:
<a name="nested_inspect_job"></a>The `inspect_job` block supports:

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

* `inspect_config` -
Expand Down