Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique length eq 0 causing naming issues #156

Open
DenisBalan opened this issue Dec 2, 2024 · 1 comment
Open

Unique length eq 0 causing naming issues #156

DenisBalan opened this issue Dec 2, 2024 · 1 comment

Comments

@DenisBalan
Copy link

having

module "naming" {
  source  = "Azure/naming/azurerm"
  suffix = [ local.env_vars.build_stage, "xxx" ]
}

locals {
    
}
output "environment_variables" {
  value     = module.naming.key_vault
}

it generated following output

environment_variables = {
  "dashes" = true
  "max_length" = 24
  "min_length" = 3
  "name" = "kv-dev-xxx"
  "name_unique" = "kv-dev-xxx-dor7"
  "regex" = "^[a-zA-Z][a-zA-Z0-9-]+[a-zA-Z0-9]$"
  "scope" = "global"
  "slug" = "kv"
}

after that, adding unique-length = 0

module "naming" {
  source  = "Azure/naming/azurerm"
  suffix = [ local.env_vars.build_stage, "xxx" ]
  unique-length = 0
}

locals {
    
}
output "environment_variables" {
  value     = module.naming.key_vault
}

it will generate invalid name with - dash at the end for the name_unique property, which obviously is not a valid name for any of the service.

  ~ environment_variables = {
        name        = "kv-dev-xxx"
      ~ name_unique = "kv-dev-xxx-dor7" -> "kv-dev-xxx-"
        # (6 unchanged attributes hidden)
    }
@Arnab-Developer
Copy link

Arnab-Developer commented Dec 12, 2024

If you are setting the unique-length to 0 at the time of module import, that means you don't want to use the name_unique in your resource name. So, why are you using it? Am I missing any of your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants