Skip to content

Commit

Permalink
Updates: Update prefix value in DA (#269)
Browse files Browse the repository at this point in the history
Updates: 
- Update the default value of prefix in DA
- Mark as required in catalog manifest
- Also allowed prefix to be "" (empty string )
  • Loading branch information
arya-girish-k authored Jan 15, 2025
1 parent 75ba974 commit cb69398
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
]
},
{
"key": "prefix"
"key": "prefix",
"required": true
},
{
"key": "skip_iam_account_settings"
Expand Down
2 changes: 1 addition & 1 deletion solutions/account-infrastructure-base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
########################################################################################################################

locals {
prefix = var.provision_atracker_cos ? lower(var.prefix) : var.prefix
prefix = var.provision_atracker_cos ? (var.prefix != null && var.prefix != "" ? lower(var.prefix) : null) : var.prefix
target_service_details = {
"IAM" = {
enforcement_mode = var.cbr_enforcement_mode
Expand Down
8 changes: 4 additions & 4 deletions solutions/account-infrastructure-base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ variable "region" {

variable "prefix" {
type = string
description = "An optional prefix to append to all resources created by this solution. If `provision_atracker_cos` is true, this value will be converted to lowercase in all instances."
default = null
description = "An optional prefix to append to all resources created by this solution. If `provision_atracker_cos` is true, this value will be converted to lowercase in all instances. Prefix value can be an empty string (\"\") or `null` for advanced users."
default = "infrabase"

# prefix restriction due to limitations when using multiple DAs in stacks
# this value was determined based on the lowest prefix restriction located here:
# https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone/blob/main/patterns/roks/variables.tf#L11
validation {
condition = var.prefix == null || can(length(var.prefix)) && length(var.prefix) <= 13
error_message = "`prefix` length must be 13 characters or less or null."
condition = (var.prefix == null || var.prefix == "") ? true : length(var.prefix) <= 13
error_message = "prefix` length must be 13 characters or less or null or an empty string (\"\")."
}
}

Expand Down

0 comments on commit cb69398

Please sign in to comment.