Open Cosmin-Apopei opened 2 years ago
Hi @Cosmin-Apopei , thank you for the issue. I have tried several times with given configuration with same location and version but it can work well.
Maybe you can get more logs or details for debug. Please refer to Debugging Terraform, you can set environment variableexport TF_LOG=debug
and export TF_LOG_PATH=./terraform.log
to get the terraform apply log. If in the log azurerm_log_analytics_workspace
is successfully created but later not found in Get method, it may be a Azure API issue.
Here is an example log of a successful creation, the PUT
request will return 201
and a GET
request after the PUT
will return 200
:
...
2022-06-09T11:53:09.141+0800 [DEBUG] provider.terraform-provider-azurerm_v3.8.0_x5: AzureRM Request:
PUT /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.OperationalInsights/workspaces/test-law?api-version=2020-08-01 HTTP/1.1^M
...
2022-06-09T11:53:18.261+0800 [DEBUG] provider.terraform-provider-azurerm_v3.8.0_x5: AzureRM Response for https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.OperationalInsights/workspaces/test-law?api-version=2020-08-01:
HTTP/2.0 201 Created^M
...
2022-06-09T11:53:19.957+0800 [DEBUG] provider.terraform-provider-azurerm_v3.8.0_x5: AzureRM Request:
GET /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.OperationalInsights/workspaces/test-law?api-version=2020-08-01 HTTP/1.1^M
...
2022-06-09T11:53:21.663+0800 [DEBUG] provider.terraform-provider-azurerm_v3.8.0_x5: AzureRM Response for https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.OperationalInsights/workspaces/test-law?api-version=2020-08-01:
HTTP/2.0 200 OK^M
If you have further findings, feel free to reply here.
I do have the same issue. I'll check the logs as you mentioned and see if I'd rather create an issue with the Azure API for that...
I assume it's almost same with https://github.com/hashicorp/terraform-provider-azurerm/issues/21627#issuecomment-1536148346
Is there an existing issue for this?
Community Note
Terraform Version
1.2.1
AzureRM Provider Version
3.8.0
Affected Resource(s)/Data Source(s)
azurerm_monitor_scheduled_query_rules_alert, azurerm_log_analytics_workspace
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The Scheduled Query Rule Alert should create.
Actual Behaviour
The Scheduled Query Rule Alert does not create because of a 404 error. Note that if you are to wait about a minute and rerun the Terraform file, the Scheduled Query Rule Alert will create (probably because the Log Analytics Workspace has existed for long enough)
Steps to Reproduce
Important Factoids
No response
References
No response