Azure / alzlib

A Go module containing the logic to process Azure Landing Zones architectures
https://pkg.go.dev/github.com/Azure/alzlib
MIT License
4 stars 6 forks source link

Feature request: Validate policy assignment name length #171

Open JWilkinsonMB opened 3 months ago

JWilkinsonMB commented 3 months ago

When creating a custom policy assignment, the name must be no more than 24 characters long. It could be helpful if this can be validated within the provider so that the error can be picked up during plan rather than at apply.

│ Error: Failed to create/update resource
│ 
│   with module.alz.module.alz_global.module.policy_assignment["global/Audit-OpenAI-ContentLogging"].azapi_resource.this,
│   on .terraform/modules/alz.alz_global/modules/azapi_helper/main.tf line 1, in resource "azapi_resource" "this":
│    1: resource "azapi_resource" "this" {
│ 
│ creating/updating Resource: (ResourceId
│ "/providers/Microsoft.Management/managementGroups/global/providers/Microsoft.Authorization/policyAssignments/Audit-OpenAI-ContentLogging-MB"
│ / Api Version "2024-04-01"): PUT
│ https://management.azure.com/providers/Microsoft.Management/managementGroups/global/providers/Microsoft.Authorization/policyAssignments/Audit-OpenAI-ContentLogging
│ --------------------------------------------------------------------------------
│ RESPONSE 400: 400 Bad Request
│ ERROR CODE: InvalidPolicyAssignmentName
│ --------------------------------------------------------------------------------
│ {
│   "error": {
│     "code": "InvalidPolicyAssignmentName",
│     "message": "The policy assignment name 'Audit-OpenAI-ContentLogging' is invalid. The policy assignment name length must not exceed '24' characters."
│   }
│ }
│ --------------------------------------------------------------------------------
│ 
matt-FFFFFF commented 1 month ago

If we choose to do this it would be here in alzlib - transferring