Skip to content

Commit

Permalink
Fix: naming condition (#72)
Browse files Browse the repository at this point in the history
* fix: correct resource name condition

The condition for Log Analytics Workspace name is currently incorrect. The correct condition as per Microsoft documentation is: "4-63 chars, Alphanumerics and hyphens. Start and end with alphanumeric."

source: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftoperationalinsights

* correct resource naming regex

According to Azure portal, the correct condition is:
- The workspace name must be between 4 and 63 characters.
- The workspace name can contain only letters, numbers and '-'. The '-' shouldn't be the first or the last symbol.
  • Loading branch information
captainhook authored Jul 25, 2024
1 parent 46c7982 commit 9e78408
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ variable "name" {
nullable = false

validation {
condition = can(regex("^[A-Za-z0-9-]{4,63}$", var.name))
condition = can(regex("^[A-Za-z0-9][A-Za-z0-9-]{2,61}[A-Za-z0-9]$", var.name))
error_message = "The name must be a valid Log Analytics Workspace name."
}
}
Expand Down

0 comments on commit 9e78408

Please sign in to comment.