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

fix: subscription display name & alias validation rule #374

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading