Skip to content

Commit 9d068cf

Browse files
[TestCase] azurerm_log_analytics_storage_insights - Mark storage_account_id as ForceNew (hashicorp#30344)
1 parent 9e87bbe commit 9d068cf

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

internal/services/loganalytics/log_analytics_storage_insights_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1717
azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
1818
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
19+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1920
"github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate"
2021
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
2122
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
@@ -191,6 +192,7 @@ func resourceLogAnalyticsStorageInsightsSchema() map[string]*pluginsdk.Schema {
191192
"storage_account_id": {
192193
Type: pluginsdk.TypeString,
193194
Required: true,
195+
ForceNew: features.FivePointOh(),
194196
ValidateFunc: commonids.ValidateStorageAccountID,
195197
},
196198

internal/services/loganalytics/log_analytics_storage_insights_resource_test.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestAccLogAnalyticsStorageInsights_updateStorageAccount(t *testing.T) {
100100
},
101101
data.ImportStep("storage_account_key"),
102102
{
103-
Config: r.updateStorageAccount(data),
103+
Config: r.updateStorageAccountKey(data),
104104
Check: acceptance.ComposeTestCheckFunc(
105105
check.That(data.ResourceName).ExistsInAzure(r),
106106
),
@@ -201,19 +201,10 @@ resource "azurerm_log_analytics_storage_insights" "test" {
201201
`, r.template(data), data.RandomInteger)
202202
}
203203

204-
func (r LogAnalyticsStorageInsightsResource) updateStorageAccount(data acceptance.TestData) string {
204+
func (r LogAnalyticsStorageInsightsResource) updateStorageAccountKey(data acceptance.TestData) string {
205205
return fmt.Sprintf(`
206206
%s
207207
208-
resource "azurerm_storage_account" "test2" {
209-
name = "acctestsads%s"
210-
resource_group_name = azurerm_resource_group.test.name
211-
212-
location = azurerm_resource_group.test.location
213-
account_tier = "Standard"
214-
account_replication_type = "LRS"
215-
}
216-
217208
resource "azurerm_log_analytics_storage_insights" "test" {
218209
name = "acctest-la-%d"
219210
resource_group_name = azurerm_resource_group.test.name
@@ -222,8 +213,8 @@ resource "azurerm_log_analytics_storage_insights" "test" {
222213
blob_container_names = ["wad-iis-logfiles"]
223214
table_names = ["WADWindowsEventLogsTable", "LinuxSyslogVer2v0"]
224215
225-
storage_account_id = azurerm_storage_account.test2.id
226-
storage_account_key = azurerm_storage_account.test2.primary_access_key
216+
storage_account_id = azurerm_storage_account.test.id
217+
storage_account_key = azurerm_storage_account.test.secondary_access_key
227218
}
228-
`, r.template(data), data.RandomStringOfLength(6), data.RandomInteger)
219+
`, r.template(data), data.RandomInteger)
229220
}

website/docs/5.0-upgrade-guide.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ Please follow the format in the example below for listing breaking changes in re
339339

340340
* The deprecated `workspace_resource_id` property has been removed and superseded by the `workspace_id` property.
341341

342+
### `azurerm_log_analytics_storage_insights`
343+
344+
* The `storage_account_id` property is marked as `ForceNew`.
345+
342346
### `azurerm_log_analytics_workspace`
343347

344348
* The deprecated `local_authentication_disabled` property has been removed in favour of the `local_authentication_enabled` property.

0 commit comments

Comments
 (0)