Skip to content

Commit 670ed2a

Browse files
mawasilemattdot
andauthored
fix(naming): add azd_env_seed for consistent random seed generation (#302)
* fix(naming): add azd_env_seed for consistent random seed generation * fix(naming): align spacing for org_prefix and org_suffix variables --------- Co-authored-by: Matt Dotson <[email protected]>
1 parent a06134c commit 670ed2a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

infra/main.naming.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
locals {
77
# Organization suffixes and prefixes are optional, and we need to form an array of non-empty values only
8-
org_prefix = compact([var.org_naming.org_prefix])
9-
org_suffix = compact([var.org_naming.org_environment, var.org_naming.org_suffix])
8+
org_prefix = compact([var.org_naming.org_prefix])
9+
org_suffix = compact([var.org_naming.org_environment, var.org_naming.org_suffix])
10+
azd_env_seed = parseint(substr(md5(var.azd_environment_name), 0, 8), 16)
1011
}
1112

1213
# Generate unique names for primary resources
@@ -25,6 +26,7 @@ resource "azurecaf_name" "main_names" {
2526
prefixes = local.org_prefix
2627
suffixes = local.org_suffix
2728
random_length = 4
29+
random_seed = local.azd_env_seed
2830
# use_slug = false
2931
clean_input = true
3032
}

0 commit comments

Comments
 (0)