aztfmod / terraform-provider-azurecaf

Terraform provider for the Terraform platform engineering for Azure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please add option to "fail_on_truncate" to never create without specific prefixes and suffixes etc

mikew3432 opened this issue · comments

We want azurecaf_name to hard fail on over length constaint, instead of trying to guess a fitting name.

Example - we want to create a key vault name - max of 24 chars

resource "azurecaf_name" "myvault" {
resource_type = "azurerm_key_vault"
separator = "-" (default)
prefixes = ["yyy"]
suffixes = ["zzz"]
name = "abcde-ghijklm-opqrst"
}

i.e. result "should" be "yyy-kv-abcde-ghijklm-opqrst-zzz" - except for being over length constraint of 24 chars

  • Desired result = hard fail to create the azurecaf_name resource due to over length name. Terraform Plan fails or Apply fails (worst case)

  • Actual result = "kv-abcde-ghijklm-opqrst" <-- prefix and suffix are dropped - keyvault created only with slug and name and possibly conflicting across our environments i.e. missing environment suffix

  • Another different actual result = prefix and slug only - missing name or suffix