From 06775c7c62da46760148640ec50122956490409c Mon Sep 17 00:00:00 2001 From: catriona-m <86247157+catriona-m@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:36:16 +0100 Subject: [PATCH] `azurerm_sentinel_data_connector_microsoft_threat_intelligence` - remove deprecated property `bing_safety_phishing_url_lookback_date` (#27171) * remove deprecated property bing_safety_phishing_url_lookback_date * update doc --- ...connector_microsoft_threat_intelligence.go | 51 +------------------ ...icrosoft_threat_intelligence.html.markdown | 6 +-- 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go b/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go index afb38d597d89..1e11fab41497 100644 --- a/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go +++ b/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2022-10-01/workspaces" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/validate" @@ -27,7 +26,6 @@ type DataConnectorMicrosoftThreatIntelligenceModel struct { Name string `tfschema:"name"` WorkspaceId string `tfschema:"log_analytics_workspace_id"` TenantId string `tfschema:"tenant_id"` - BingSafetyPhishingUrlLookBackDate string `tfschema:"bing_safety_phishing_url_lookback_date"` MicrosoftEmergingThreatFeedLookBackDate string `tfschema:"microsoft_emerging_threat_feed_lookback_date"` } @@ -37,7 +35,7 @@ type DataConnectorMicrosoftThreatIntelligenceDataType struct { } func (s DataConnectorMicrosoftThreatIntelligenceResource) Arguments() map[string]*schema.Schema { - res := map[string]*schema.Schema{ + return map[string]*schema.Schema{ "name": { Type: pluginsdk.TypeString, Required: true, @@ -64,32 +62,10 @@ func (s DataConnectorMicrosoftThreatIntelligenceResource) Arguments() map[string "microsoft_emerging_threat_feed_lookback_date": { Type: pluginsdk.TypeString, ForceNew: true, - Optional: !features.FourPointOh(), - Required: features.FourPointOh(), + Required: true, ValidateFunc: validation.IsRFC3339Time, - AtLeastOneOf: func() []string { - if !features.FourPointOh() { - return []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"} - } - return []string{} - }(), }, } - - if !features.FourPointOh() { - // this has been removed in newer API version, and it's actually not working in current API version - // TODO Remove in 4.0 - res["bing_safety_phishing_url_lookback_date"] = &schema.Schema{ - Deprecated: "This field is deprecated and will be removed in version 4.0 of the AzureRM Provider.", - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IsRFC3339Time, - AtLeastOneOf: []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"}, - } - } - - return res } func (s DataConnectorMicrosoftThreatIntelligenceResource) Attributes() map[string]*schema.Schema { @@ -140,7 +116,6 @@ func (s DataConnectorMicrosoftThreatIntelligenceResource) Create() sdk.ResourceF Kind: securityinsight.KindBasicDataConnectorKindMicrosoftThreatIntelligence, MSTIDataConnectorProperties: &securityinsight.MSTIDataConnectorProperties{ DataTypes: &securityinsight.MSTIDataConnectorDataTypes{ - BingSafetyPhishingURL: expandSentinelDataConnectorMicrosoftThreatIntelligenceBingSafetyPhishingUrl(metaModel), MicrosoftEmergingThreatFeed: expandSentinelDataConnectorMicrosoftThreatIntelligenceMicrosoftEmergingThreatFeed(metaModel), }, TenantID: &tenantId, @@ -193,14 +168,6 @@ func (s DataConnectorMicrosoftThreatIntelligenceResource) Read() sdk.ResourceFun } if dt := dc.DataTypes; dt != nil { - if dt.BingSafetyPhishingURL != nil { - if strings.EqualFold(string(dt.BingSafetyPhishingURL.State), string(securityinsight.DataTypeStateEnabled)) { - state.BingSafetyPhishingUrlLookBackDate, err = flattenSentinelDataConnectorMicrosoftThreatIntelligenceTime(*dt.BingSafetyPhishingURL.LookbackPeriod) - if err != nil { - return fmt.Errorf("flattening `bing_safety_phishing_url`: %+v", err) - } - } - } if dt.MicrosoftEmergingThreatFeed != nil { if strings.EqualFold(string(dt.MicrosoftEmergingThreatFeed.State), string(securityinsight.DataTypeStateEnabled)) { state.MicrosoftEmergingThreatFeedLookBackDate, err = flattenSentinelDataConnectorMicrosoftThreatIntelligenceTime(*dt.MicrosoftEmergingThreatFeed.LookbackPeriod) @@ -240,20 +207,6 @@ func (s DataConnectorMicrosoftThreatIntelligenceResource) IDValidationFunc() plu return validate.DataConnectorID } -func expandSentinelDataConnectorMicrosoftThreatIntelligenceBingSafetyPhishingUrl(input DataConnectorMicrosoftThreatIntelligenceModel) *securityinsight.MSTIDataConnectorDataTypesBingSafetyPhishingURL { - if input.BingSafetyPhishingUrlLookBackDate == "" { - return &securityinsight.MSTIDataConnectorDataTypesBingSafetyPhishingURL{ - LookbackPeriod: utils.String(""), - State: securityinsight.DataTypeStateDisabled, - } - } - - return &securityinsight.MSTIDataConnectorDataTypesBingSafetyPhishingURL{ - LookbackPeriod: utils.String(input.BingSafetyPhishingUrlLookBackDate), - State: securityinsight.DataTypeStateEnabled, - } -} - func expandSentinelDataConnectorMicrosoftThreatIntelligenceMicrosoftEmergingThreatFeed(input DataConnectorMicrosoftThreatIntelligenceModel) *securityinsight.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed { if input.MicrosoftEmergingThreatFeedLookBackDate == "" { return &securityinsight.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed{ diff --git a/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown b/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown index bf6aba374b59..52c189508183 100644 --- a/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown +++ b/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown @@ -48,11 +48,7 @@ The following arguments are supported: * `log_analytics_workspace_id` - (Required) The ID of the Log Analytics Workspace. Changing this forces a new Data Connector to be created. -* `microsoft_emerging_threat_feed_lookback_date` - (Optional) The lookback date for the Microsoft Emerging Threat Feed in RFC3339. Changing this forces a new Data Connector to be created. - --> **Note:** `microsoft_emerging_threat_feed_lookback_date` will be required in version 4.0 of the provider. - --> **NOTE:** At least one of `bing_safety_phishing_url_lookback_date` and `microsoft_emerging_threat_feed_lookback_date` must be specified. +* `microsoft_emerging_threat_feed_lookback_date` - (Required) The lookback date for the Microsoft Emerging Threat Feed in RFC3339. Changing this forces a new Data Connector to be created. ---