Skip to content

Commit

Permalink
[datadog_sensitive_data_scanner_group] Avoid panic when nil returned (#…
Browse files Browse the repository at this point in the history
…2097)

* Avoid panic when nil returned

* Validate product_list attribute

* make docs

* remove err check in favor of validation

---------

Co-authored-by: Sherzod Karimov <[email protected]>
  • Loading branch information
mikutas and skarimo authored Sep 13, 2023
1 parent 55fcfc9 commit 0441602
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion datadog/resource_datadog_sensitive_data_scanner_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/terraform-providers/terraform-provider-datadog/datadog/internal/utils"
"github.com/terraform-providers/terraform-provider-datadog/datadog/internal/validators"
)

var sensitiveDataScannerMutex = sync.Mutex{}
Expand Down Expand Up @@ -41,7 +42,8 @@ func resourceDatadogSensitiveDataScannerGroup() *schema.Resource {
Required: true,
MaxItems: 4,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ValidateDiagFunc: validators.ValidateEnumValue(datadogV2.NewSensitiveDataScannerProductFromValue),
},
},
"is_enabled": {
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/sensitive_data_scanner_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ resource "datadog_sensitive_data_scanner_group" "mygroup" {
- `filter` (Block List, Min: 1, Max: 1) Filter object the scanning group applies. (see [below for nested schema](#nestedblock--filter))
- `is_enabled` (Boolean) Whether or not the scanning group is enabled. If the group doesn't contain any rule or if all the rules in it are disabled, the group is force-disabled by our backend
- `name` (String) Name of the Datadog scanning group.
- `product_list` (Set of String) List of products the scanning group applies.
- `product_list` (Set of String) List of products the scanning group applies. Valid values are `logs`, `rum`, `events`, `apm`.

### Optional

Expand Down

0 comments on commit 0441602

Please sign in to comment.