From 26213d34506684a3947800f5acf79642328535d3 Mon Sep 17 00:00:00 2001 From: kt Date: Mon, 28 Oct 2024 13:37:21 -0700 Subject: [PATCH 1/3] azurerm_container_app_environment - changing the log_analytics_workspace_id property no longer creates a new resource --- .../container_app_environment_resource.go | 1 - .../container_app_environment_resource_test.go | 10 +++++++++- website/docs/r/container_app_environment.html.markdown | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/internal/services/containerapps/container_app_environment_resource.go b/internal/services/containerapps/container_app_environment_resource.go index b004e10726b8..d5f2a246cc5e 100644 --- a/internal/services/containerapps/container_app_environment_resource.go +++ b/internal/services/containerapps/container_app_environment_resource.go @@ -91,7 +91,6 @@ func (r ContainerAppEnvironmentResource) Arguments() map[string]*pluginsdk.Schem "log_analytics_workspace_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: workspaces.ValidateWorkspaceID, Description: "The ID for the Log Analytics Workspace to link this Container Apps Managed Environment to.", }, diff --git a/internal/services/containerapps/container_app_environment_resource_test.go b/internal/services/containerapps/container_app_environment_resource_test.go index 61e8d1618e66..d2547b353097 100644 --- a/internal/services/containerapps/container_app_environment_resource_test.go +++ b/internal/services/containerapps/container_app_environment_resource_test.go @@ -324,11 +324,19 @@ provider "azurerm" { %[1]s +resource "azurerm_log_analytics_workspace" "text-second" { + name = "acctestLAW-second-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} + resource "azurerm_container_app_environment" "test" { name = "acctest-CAEnv%[2]d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location - log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + log_analytics_workspace_id = azurerm_log_analytics_workspace.text-second.id infrastructure_subnet_id = azurerm_subnet.control.id internal_load_balancer_enabled = true diff --git a/website/docs/r/container_app_environment.html.markdown b/website/docs/r/container_app_environment.html.markdown index bfac1ee8168f..9a878d0cf9d9 100644 --- a/website/docs/r/container_app_environment.html.markdown +++ b/website/docs/r/container_app_environment.html.markdown @@ -64,7 +64,7 @@ The following arguments are supported: ~> **Note:** can only be set to `true` if `infrastructure_subnet_id` is specified. -* `log_analytics_workspace_id` - (Optional) The ID for the Log Analytics Workspace to link this Container Apps Managed Environment to. Changing this forces a new resource to be created. +* `log_analytics_workspace_id` - (Optional) The ID for the Log Analytics Workspace to link this Container Apps Managed Environment to. * `workload_profile` - (Optional) The profile of the workload to scope the container app execution. A `workload_profile` block as defined below. From e247082fbc3cd8dc5d73b0839dada2d136dbf86c Mon Sep 17 00:00:00 2001 From: kt Date: Mon, 28 Oct 2024 13:42:28 -0700 Subject: [PATCH 2/3] update resource name --- .../containerapps/container_app_environment_resource_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/containerapps/container_app_environment_resource_test.go b/internal/services/containerapps/container_app_environment_resource_test.go index d2547b353097..4c4e89a31129 100644 --- a/internal/services/containerapps/container_app_environment_resource_test.go +++ b/internal/services/containerapps/container_app_environment_resource_test.go @@ -324,7 +324,7 @@ provider "azurerm" { %[1]s -resource "azurerm_log_analytics_workspace" "text-second" { +resource "azurerm_log_analytics_workspace" "second" { name = "acctestLAW-second-%[1]d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name @@ -336,7 +336,7 @@ resource "azurerm_container_app_environment" "test" { name = "acctest-CAEnv%[2]d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location - log_analytics_workspace_id = azurerm_log_analytics_workspace.text-second.id + log_analytics_workspace_id = azurerm_log_analytics_workspace.second.id infrastructure_subnet_id = azurerm_subnet.control.id internal_load_balancer_enabled = true From 674af3c4508e1b0c01cdf70814f3a6c7bbbc8dc4 Mon Sep 17 00:00:00 2001 From: kt Date: Mon, 28 Oct 2024 13:51:37 -0700 Subject: [PATCH 3/3] fix build --- .../containerapps/container_app_environment_resource_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/containerapps/container_app_environment_resource_test.go b/internal/services/containerapps/container_app_environment_resource_test.go index 4c4e89a31129..870d5a814d8d 100644 --- a/internal/services/containerapps/container_app_environment_resource_test.go +++ b/internal/services/containerapps/container_app_environment_resource_test.go @@ -325,7 +325,7 @@ provider "azurerm" { %[1]s resource "azurerm_log_analytics_workspace" "second" { - name = "acctestLAW-second-%[1]d" + name = "acctestLAW-second-%[2]d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name sku = "PerGB2018"