Skip to content

Commit

Permalink
azurerm_sentinel_data_connector_microsoft_threat_intelligence: depr…
Browse files Browse the repository at this point in the history
…ecate `bing_safety_phishing_url_lookback_date` (#21954)
  • Loading branch information
ziyeqf authored Jun 7, 2023
1 parent 419ce36 commit 4c4f35c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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"
Expand All @@ -33,7 +34,7 @@ type DataConnectorMicrosoftThreatIntelligenceDataType struct {
}

func (s DataConnectorMicrosoftThreatIntelligenceResource) Arguments() map[string]*schema.Schema {
return map[string]*schema.Schema{
res := map[string]*schema.Schema{
"name": {
Type: pluginsdk.TypeString,
Required: true,
Expand All @@ -56,22 +57,36 @@ func (s DataConnectorMicrosoftThreatIntelligenceResource) Arguments() map[string
ValidateFunc: validation.IsUUID,
},

"bing_safety_phishing_url_lookback_date": {
//lintignore: S013
"microsoft_emerging_threat_feed_lookback_date": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Optional: !features.FourPointOh(),
Required: features.FourPointOh(),
ValidateFunc: validation.IsRFC3339Time,
AtLeastOneOf: []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"},
AtLeastOneOf: func() []string {
if !features.FourPointOh() {
return []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"}
}
return []string{}
}(),
},
}

"microsoft_emerging_threat_feed_lookback_date": {
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,
ForceNew: true,
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ resource "azurerm_sentinel_data_connector_microsoft_threat_intelligence" "test"
log_analytics_workspace_id = azurerm_sentinel_log_analytics_workspace_onboarding.test.workspace_id
tenant_id = data.azurerm_client_config.test.tenant_id
microsoft_emerging_threat_feed_lookback_date = "1970-01-01T00:00:00Z"
bing_safety_phishing_url_lookback_date = "1970-01-01T00:00:00Z"
}
`, r.template(data), data.RandomInteger)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ resource "azurerm_sentinel_log_analytics_workspace_onboarding" "example" {
resource "azurerm_sentinel_data_connector_microsoft_threat_intelligence" "example" {
name = "example-dc-msti"
log_analytics_workspace_id = azurerm_sentinel_log_analytics_workspace_onboarding.example.workspace_id
bing_safety_phishing_url_lookback_date = "1970-01-01T00:00:00Z"
microsoft_emerging_threat_feed_lookback_date = "1970-01-01T00:00:00Z"
}
```
Expand All @@ -51,8 +50,12 @@ The following arguments are supported:

* `bing_safety_phishing_url_lookback_date` - (Optional) The lookback date for the Bing Safety Phishing Url in RFC3339. Changing this forces a new Data Connector to be created.

-> **Note:** `bing_safety_phishing_url_lookback_date` has been deprecated as the API no longer supports it and will be removed in version 4.0 of the provider.

* `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.

---
Expand Down

0 comments on commit 4c4f35c

Please sign in to comment.