diff --git a/internal/services/sentinel/sentinel_alert_rule_scheduled_resource.go b/internal/services/sentinel/sentinel_alert_rule_scheduled_resource.go index dbfbea983747..7309fc2c5121 100644 --- a/internal/services/sentinel/sentinel_alert_rule_scheduled_resource.go +++ b/internal/services/sentinel/sentinel_alert_rule_scheduled_resource.go @@ -73,7 +73,6 @@ func resourceSentinelAlertRuleScheduled() *pluginsdk.Resource { "alert_rule_template_version": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, }, "description": { diff --git a/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go b/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go index 5dd9eb58c3b2..73850973ce5c 100644 --- a/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go +++ b/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go @@ -33,6 +33,28 @@ func TestAccSentinelAlertRuleScheduled_basic(t *testing.T) { }) } +func TestAccSentinelAlertRuleScheduled_upgrade(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_alert_rule_scheduled", "test") + r := SentinelAlertRuleScheduledResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.upgradeVersion(data, "1.0.4"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.upgradeVersion(data, "1.0.5"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccSentinelAlertRuleScheduled_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_alert_rule_scheduled", "test") r := SentinelAlertRuleScheduledResource{} @@ -339,6 +361,28 @@ QUERY `, r.template(data), data.RandomInteger) } +func (r SentinelAlertRuleScheduledResource) upgradeVersion(data acceptance.TestData, version string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_sentinel_alert_rule_scheduled" "test" { + name = "acctest-SentinelAlertRule-Sche-%d" + log_analytics_workspace_id = azurerm_sentinel_log_analytics_workspace_onboarding.test.workspace_id + display_name = "Some Rule" + alert_rule_template_guid = "173f8699-6af5-484a-8b06-8c47ba89b380" + alert_rule_template_version = "%[3]s" + severity = "Medium" + query = <