-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating multiple azurerm_kusto_script resources at once causes [Conflict] errors on cluster #16471
Comments
Thanks, subscribed to that issue. The best workaround I've found so far is to create a single resource for each script, add an explicit dependency on the previous one to force sequential creation. This workaround is quite verbose so it would be ideal to have a fix for the concurrency issue. Perhaps when we get the error code that the cluster is in maintenance, the provider waits some amount of time before trying again. locals {
numScripts = 2
}
resource "azurerm_kusto_script" "adx_setup_script_subset_index_zero" {
for_each = { for b in local.adx_scripts : "${b.cluster_index}.${b.database_index}.${b.script_index}" => b if index(local.adx_scripts, b) % local.numScripts == 0 }
name = "${each.value.database_index}_${each.value.script_index}"
...
# Create an explicit dependency on the cluster
depends_on = [
azurerm_kusto_cluster.cluster
]
}
resource "azurerm_kusto_script" "adx_setup_script_subset_index_one" {
for_each = { for b in local.adx_scripts : "${b.cluster_index}.${b.database_index}.${b.script_index}" => b if index(local.adx_scripts, b) % local.numScripts == 1 }
name = "${each.value.database_index}_${each.value.script_index}"
...
# Create an explicit dependency on the previous subset of scripts to avoid Conflict errors
depends_on = [
azurerm_kusto_script.adx_setup_script_subset_index_zero
]
}
... more scripts |
This functionality has been released in v3.5.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Hey @mojanas and @sinbai, I went ahead and threw a lock into kusto database/scripts so that managing those resources happens sequentially rather than all at once which was causing your issue. You shouldn't have to do any weird code things in your config file to use that once you upgrade to the latest version of the provider. |
Hey @mbfrahry thanks for looking into this! I updated to v3.5.0 and am still seeing the same error. Looking at your PR fix, I believe we actually want to lock the cluster instead of the databases. Though the kusto scripts are created with respect to a particular database, they actually modify the cluster configuration. I have a draft PR here, feel free to add updates to it: #16690 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Is there an existing issue for this?
Community Note
Terraform Version
1.0.8
AzureRM Provider Version
2.96.0
Affected Resource(s)/Data Source(s)
azurerm_kusto_script
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Terraform creates the scripts sequentially without any errors.
Actual Behaviour
Terraform created one script successfully, then failed for the rest with
Code="ServiceIsInMaintenance"
Steps to Reproduce
Use the configuration above or create a new configuration with 5+ databases and scripts all defined within the same resource and looped using for_each
Important Factoids
No response
References
No response
The text was updated successfully, but these errors were encountered: