hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.58k stars 4.62k forks source link

Irrelevant `name` property on `azurerm_kusto_database_principal_assignment`? #19349

Open sebader opened 1 year ago

sebader commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.2

AzureRM Provider Version

3.31.0

Affected Resource(s)/Data Source(s)

azurerm_kusto_database_principal_assignment

Terraform Configuration Files

resource "azurerm_kusto_database_principal_assignment" "foo" {
  name                = "AM-I-REQUIRED"
  resource_group_name = azurerm_resource_group.stamp.name
  cluster_name        = azurerm_kusto_cluster.stamp.name
  database_name       = azurerm_kusto_database.snapshots.name

  tenant_id      = data.azurerm_client_config.current.tenant_id
  principal_id   = azurerm_user_assigned_identity.foo.principal_id
  principal_type = "App"
  role           = "Viewer"
}

Debug Output/Panic Output

n/a

Expected Behaviour

No response

Actual Behaviour

azurerm_kusto_database_principal_assignment requires a property name. This is missing from the docs (although it is mentioned in the sample). But more importantly, it is not clear to me if this field is actually required?! It could just be auto-generated by Terraform like for regular RBAC assignments.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

liuwuliuyun commented 1 year ago

Hi @sebader , thanks for raising this issue. This property is nessesary because it is an independant azure resource. To identify a azure resource, you have to specify a name. The id of this resource is like

/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}

For the doc missing part, I have raised PR to fix that.

sebader commented 1 year ago

Ok understood. I would still opt to make it optional in the same way as for role assignments https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment

name - (Optional) A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.

tombuildsstuff commented 1 year ago

@sebader

Ok understood. I would still opt to make it optional in the same way as for role assignments

Agreed, we should be generating one in the Create unless a user explicitly specifies one, would you be able to take a look into that one @liuwuliuyun?

tombuildsstuff commented 1 year ago

re-opening this since we should also generate one in the create if unspecified

liuwuliuyun commented 1 year ago

@sebader

Ok understood. I would still opt to make it optional in the same way as for role assignments

Agreed, we should be generating one in the Create unless a user explicitly specifies one, would you be able to take a look into that one @liuwuliuyun?

Ok, let me look into this and keep tracking that in this PR.