terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
Getting error while creating SQL Server with UMI (User Manage Identity)
Is there an existing issue for this?
- [X] I have searched the existing issues
Community Note
- Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
1.0.11
AzureRM Provider Version
3.0.0
Affected Resource(s)/Data Source(s)
azurerm_mssql_server
Terraform Configuration Files
resource "azurerm_mssql_server" "sql_server" {
name = var.sql_server_name
resource_group_name = var.rg_name
location = var.rg_location
version = var.server_version
administrator_login = var.admin_login
administrator_login_password = "Rock2424"
outbound_network_restriction_enabled = true
minimum_tls_version = "1.2"
dynamic "identity" {
for_each = var.enable_manage_identity == false ? toset([]) : toset([1])
content {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.user_assigned_identity.id]
}
}
primary_user_assigned_identity_id = var.enable_manage_identity == false? null: azurerm_user_assigned_identity.user_assigned_identity[0].id
azuread_administrator {
login_username = var.ad_admin_server
object_id = var.ad_admin_server_object_id
}
tags = var.tags
}
resource "azurerm_user_assigned_identity" "user_assigned_identity" {
count = var.enable_manage_identity ? 1 : 0
name = "${var.sql_server_name}-identity"
location = var.rg_location
resource_group_name = var.rg_name
}
Debug Output/Panic Output
Getting error
Error: Missing required argument
with azurerm_mssql_server.sql_server,
on main.tf line 25, in resource "azurerm_mssql_server" "sql_server":
primary_user_assigned_identity_id = azurerm_user_assigned_identity.user_assigned_identity[0].id
"primary_user_assigned_identity_id": all of identity.0.identity_ids,primary_user_assigned_identity_id must be specified
Expected Behaviour
I should be able to assign primary manage-identity as the one that I have created
Actual Behaviour
Getting error
Error: Missing required argument
with azurerm_mssql_server.sql_server, on main.tf line 25, in resource "azurerm_mssql_server" "sql_server": primary_user_assigned_identity_id = azurerm_user_assigned_identity.user_assigned_identity[0].id
"primary_user_assigned_identity_id": all of identity.0.identity_ids,primary_user_assigned_identity_id must be specified
Steps to Reproduce
No response
Important Factoids
No response
References
No response
@malikdaman24 thanks for opening this issue here. The issue has been fixed by PR #17556. This fix is expected to be release in the upcoming release, could you track that to see whether you would then be unblocked?
Closing since this appears to have been fixed in v3.14.0
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.