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

azurerm_sentinel_data_connector_microsoft_threat_intelligence: deprecate bing_safety_phishing_url_lookback_date #21954

Merged
merged 7 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
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,27 @@ func (s DataConnectorMicrosoftThreatIntelligenceResource) Arguments() map[string
ValidateFunc: validation.IsUUID,
},

"bing_safety_phishing_url_lookback_date": {
"microsoft_emerging_threat_feed_lookback_date": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Required: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a breaking change, let's set Required/Optional by the FourPointOh feature flag. We also need to update the docs to say this is Required now

ValidateFunc: validation.IsRFC3339Time,
AtLeastOneOf: []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"},
},
}

"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,6 +50,8 @@ 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:** At least one of `bing_safety_phishing_url_lookback_date` and `microsoft_emerging_threat_feed_lookback_date` must be specified.
Expand Down