@@ -14,21 +14,18 @@ locals {
1414 is_linux = lower (var. vm . os_type ) == " linux"
1515 is_windows = lower (var. vm . os_type ) == " windows"
1616
17- vm_type_prefix = local. is_linux ? " lnx" : " win"
18- # We use var.name as workload and var.vm.name_suffix as the suffix (usually 001)
19- vm_name_raw = " vm-${ local . vm_type_prefix } -${ local . prefix } -${ try (var. vm . name_suffix , " 001" )} "
20- vm_name = coalesce (try (var. vm . name , null ), substr (replace (lower (local. vm_name_raw ), " /[^0-9a-z-]/" , " " ), 0 , 64 ))
17+ # Resource names: use var.name directly as the full name
18+ vm_name = var. name
2119
22- # Windows has 15 char limit; Linux is flexible, but keep consistent.
23- # Truncate to 15 and trim trailing dashes to avoid Azure validation errors.
20+ # Windows has 15 char limit; Linux is flexible.
2421 computer_name = coalesce (try (var. vm . computer_name , null ), trim (substr (local. vm_name , 0 , 15 ), " -" ))
2522
26- nic_name = " nic-${ local . vm_type_prefix } - ${ local . prefix } - ${ try (var . vm . name_suffix , " 001 " ) } "
27- pip_name = " pip-${ local . vm_type_prefix } - ${ local . prefix } - ${ try (var . vm . name_suffix , " 001 " ) } "
23+ nic_name = " nic-${ local . vm_name } "
24+ pip_name = " pip-${ local . vm_name } "
2825
2926 os_disk_name = coalesce (
3027 try (var. vm . os_disk . name , null ),
31- " osdisk-${ local . vm_type_prefix } - ${ local . prefix } - ${ try (var . vm . name_suffix , " 001 " ) } "
28+ " osdisk-${ local . vm_name } "
3229 )
3330
3431 identity_type = try (var. vm . identity . type , " SystemAssigned" )
0 commit comments