Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo committed Dec 13, 2023
1 parent 1352dca commit ae25e33
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" // nolint: staticcheck
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/azuresdkhacks"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand All @@ -20,6 +21,17 @@ import (
// TODO: this resource should be split into data_export_setting and alert_sync_setting

func resourceSecurityCenterSetting() *pluginsdk.Resource {
validSettingName := []string{
"MCAS",
"WDATP",
"Sentinel",
}
if !features.FourPointOhBeta() {
// This is for backward compatibility.. The swagger defines the valid enum to be "Sensinel" (see below), so this ("SENTINEL") shall be removed since 4.0.
// https://github.com/Azure/azure-rest-api-specs/blob/b52464f520b77222ac8b0bdeb80a030c0fdf5b1b/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/settings.json#L285
validSettingName = append(validSettingName, "SENTINEL")
}

return &pluginsdk.Resource{
Create: resourceSecurityCenterSettingUpdate,
Read: resourceSecurityCenterSettingRead,
Expand All @@ -40,18 +52,10 @@ func resourceSecurityCenterSetting() *pluginsdk.Resource {

Schema: map[string]*pluginsdk.Schema{
"setting_name": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"MCAS",
"WDATP",
"Sentinel",

// TODO 4.0: Remove this per the swagger definition:
// https://github.com/Azure/azure-rest-api-specs/blob/b52464f520b77222ac8b0bdeb80a030c0fdf5b1b/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/settings.json#L285
"SENTINEL",
}, false),
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(validSettingName, false),
},
"enabled": {
Type: pluginsdk.TypeBool,
Expand Down

0 comments on commit ae25e33

Please sign in to comment.