-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws: Add validation for aws_db_instance.identifier #2516
provider/aws: Add validation for aws_db_instance.identifier #2516
Conversation
6ba201f
to
3a98525
Compare
LGTM |
provider/aws: Add validation for aws_db_instance.identifier
@@ -74,6 +74,26 @@ func resourceAwsDbInstance() *schema.Resource { | |||
Type: schema.TypeString, | |||
Required: true, | |||
ForceNew: true, | |||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { | |||
value := v.(string) | |||
if !regexp.MustCompile(`^[0-9a-z-]$`).MatchString(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be [0-9a-z-]$
instead of ^[0-9a-z-]$
?
foobarbaz-test-terraform-test2
is failing:
http://rubular.com/r/ixQHBNXPiV vs http://rubular.com/r/difJw4AHVJ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this should actually be ^[0-9a-z-]+$
(i.e. quantifier +
is missing, so it's checking a single character only), thanks for noticing, fix is on the way.
In fact there doesn't seem to be any logic for lowercasing the identifier, so it should be 🆗 |
@radeksimko yeah - the acctests are passing here so we're good to leave it |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
http://docs.aws.amazon.com/cli/latest/reference/rds/create-db-instance.html
I did not bother with the character limit since it's engine-specific and it's not quite easy yet to do validation based on other fields.