# Terraform azure provider behaviour for Log Analytics Workspace

**URL:** <https://discuss.hashicorp.com/t/terraform-azure-provider-behaviour-for-log-analytics-workspace/59316>\
**Category:** Azure\
**Tags:** azure\
**Created:** [October 19, 2023, 2:58pm UTC](https://discuss.hashicorp.com/t/terraform-azure-provider-behaviour-for-log-analytics-workspace/59316 "2023-10-19T14:58:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raihaniqbal1999](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/raihaniqbal1999/32/38442_2.png) [@raihaniqbal1999](https://discuss.hashicorp.com/u/raihaniqbal1999)\
**Post date:** [October 19, 2023, 2:58pm UTC](https://discuss.hashicorp.com/t/terraform-azure-provider-behaviour-for-log-analytics-workspace/59316/1 "2023-10-19T14:58:08Z")

</div>

We are creating log analytics workspace using the following terraform code:

resource “azurerm\_log\_analytics\_workspace” “workspace” {  
count = var.workspace\_id == null ? 1 : 0  
name = var.workspace\_name  
location = var.location  
resource\_group\_name = var.resource\_group\_name  
sku = var.sku  
retention\_in\_days = var.retention\_in\_days  
}  
and we have not used --force delete flag and but we ran a terraform apply command ,due to incorrect region it destroyed the workspace (hard delete: non recoverable) instead of soft delete.  
terraform plan command:

terraform plan -out=tfplan

Terraform apply command:  
terraform apply -no-color -input=false -auto-approve tfplan
