Skip to content

Commit

Permalink
fix: subscription display name & alias validation rule (#374)
Browse files Browse the repository at this point in the history
* fix: subscription display name & alias validation rule

* chore: docs

* chore: telemetry change

---------

Co-authored-by: Matt White <[email protected]>
  • Loading branch information
kewalaka and matt-FFFFFF authored Jun 7, 2024
1 parent 097ae5a commit b51493f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion locals.version.tf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"locals": {
"module_version": "4.1.2"
"module_version": "4.1.3"
}
}
2 changes: 1 addition & 1 deletion modules/subscription/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Default: `""`
Description: The display name of the subscription alias.

The string must be comprised of a-z, A-Z, 0-9, -, \_ and space.
The maximum length is 63 characters.
The maximum length is 64 characters.

You may also supply an empty string if you do not want to create a new subscription alias.
In this scenario, `subscription_enabled` should be set to `false` and `subscription_id` must be supplied.
Expand Down
10 changes: 5 additions & 5 deletions modules/subscription/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ You may also supply an empty string if you do not want to create a new subscript
In this scenario, `subscription_enabled` should be set to `false` and `subscription_id` must be supplied.
DESCRIPTION
validation {
condition = can(regex("^$|^[a-zA-Z0-9-_]{1,63}$", var.subscription_alias_name))
error_message = "Valid characters are a-z, A-Z, 0-9, -, _."
condition = length(var.subscription_alias_name) <= 64 && !can(regex("[<>;|]", var.subscription_alias_name))
error_message = "Subscription Alias must either \"\", or be less or equal to 64 characters in length and cannot contain the characters `<`, `>`, `;`, or `|`"
}
}

Expand All @@ -50,14 +50,14 @@ variable "subscription_display_name" {
The display name of the subscription alias.
The string must be comprised of a-z, A-Z, 0-9, -, _ and space.
The maximum length is 63 characters.
The maximum length is 64 characters.
You may also supply an empty string if you do not want to create a new subscription alias.
In this scenario, `subscription_enabled` should be set to `false` and `subscription_id` must be supplied.
DESCRIPTION
validation {
condition = can(regex("^$|^[a-zA-Z0-9-_ ]{1,63}$", var.subscription_display_name))
error_message = "Valid characters are a-z, A-Z, 0-9, -, _, and space."
condition = length(var.subscription_display_name) > 0 && length(var.subscription_display_name) <= 64 && !can(regex("[<>;|]", var.subscription_display_name))
error_message = "Subscription Name must be between 1 and 64 characters in length and cannot contain the characters `<`, `>`, `;`, or `|`"
}
}

Expand Down

0 comments on commit b51493f

Please sign in to comment.