From 922ccb2cabebc4aeff1601e928a46b9e9389eed9 Mon Sep 17 00:00:00 2001 From: Brian Adams Date: Sun, 1 Oct 2023 10:37:18 -0400 Subject: [PATCH 1/5] Allow periods in parameter groups for RDS --- internal/service/rds/validate.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/rds/validate.go b/internal/service/rds/validate.go index 6a627922034..7f3617a5860 100644 --- a/internal/service/rds/validate.go +++ b/internal/service/rds/validate.go @@ -11,7 +11,7 @@ import ( func validEventSubscriptionName(v interface{}, k string) (ws []string, errors []error) { value := v.(string) - if !regexache.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) { + if !regexache.MustCompile(`^[0-9A-Za-z-.]+$`).MatchString(value) { errors = append(errors, fmt.Errorf( "only alphanumeric characters and hyphens allowed in %q", k)) } @@ -70,9 +70,9 @@ func validOptionGroupNamePrefix(v interface{}, k string) (ws []string, errors [] func validParamGroupName(v interface{}, k string) (ws []string, errors []error) { value := v.(string) - if !regexache.MustCompile(`^[0-9a-z-]+$`).MatchString(value) { + if !regexache.MustCompile(`^[0-9a-z-.]+$`).MatchString(value) { errors = append(errors, fmt.Errorf( - "only lowercase alphanumeric characters and hyphens allowed in parameter group %q", k)) + "only lowercase alphanumeric characters, hyphens, and periods allowed in parameter group %q", k)) } if !regexache.MustCompile(`^[a-z]`).MatchString(value) { errors = append(errors, fmt.Errorf( From d90499499119a40c257baa8ec98a809157346cbc Mon Sep 17 00:00:00 2001 From: Brian Adams Date: Sun, 1 Oct 2023 10:47:40 -0400 Subject: [PATCH 2/5] Add default pg param group name to tests --- internal/service/rds/validate_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/service/rds/validate_test.go b/internal/service/rds/validate_test.go index 49c9554c39c..c02eee2c064 100644 --- a/internal/service/rds/validate_test.go +++ b/internal/service/rds/validate_test.go @@ -124,6 +124,10 @@ func TestValidParamGroupName(t *testing.T) { Value string ErrCount int }{ + { + Value: "default.postgres9.6", + ErrCount: 0, + }, { Value: "tEsting123", ErrCount: 1, From bc46469799b0958f72c2d3270f2eca61ae0daa52 Mon Sep 17 00:00:00 2001 From: Brian Adams Date: Sun, 1 Oct 2023 11:20:01 -0400 Subject: [PATCH 3/5] Fix additional period added to even subscription --- internal/service/rds/validate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rds/validate.go b/internal/service/rds/validate.go index 7f3617a5860..4358a691794 100644 --- a/internal/service/rds/validate.go +++ b/internal/service/rds/validate.go @@ -11,7 +11,7 @@ import ( func validEventSubscriptionName(v interface{}, k string) (ws []string, errors []error) { value := v.(string) - if !regexache.MustCompile(`^[0-9A-Za-z-.]+$`).MatchString(value) { + if !regexache.MustCompile(`^[0-9A-Za-z-]+$`).MatchString(value) { errors = append(errors, fmt.Errorf( "only alphanumeric characters and hyphens allowed in %q", k)) } From aa286f4760de862dcf30f26ea7a460c8fe1cb3ca Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Wed, 11 Oct 2023 10:31:34 -0400 Subject: [PATCH 4/5] chore: adjust regex order adopting the ordering outlined in the regular expression contributing guide: https://hashicorp.github.io/terraform-provider-aws/regular-expressions/ --- internal/service/rds/validate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/rds/validate.go b/internal/service/rds/validate.go index 4358a691794..1647dc456f3 100644 --- a/internal/service/rds/validate.go +++ b/internal/service/rds/validate.go @@ -70,9 +70,9 @@ func validOptionGroupNamePrefix(v interface{}, k string) (ws []string, errors [] func validParamGroupName(v interface{}, k string) (ws []string, errors []error) { value := v.(string) - if !regexache.MustCompile(`^[0-9a-z-.]+$`).MatchString(value) { + if !regexache.MustCompile(`^[0-9a-z.-]+$`).MatchString(value) { errors = append(errors, fmt.Errorf( - "only lowercase alphanumeric characters, hyphens, and periods allowed in parameter group %q", k)) + "only lowercase alphanumeric characters, periods, and hyphens allowed in parameter group %q", k)) } if !regexache.MustCompile(`^[a-z]`).MatchString(value) { errors = append(errors, fmt.Errorf( From decb2b67fdc903f391ef2dc05dafc1d65c9b5737 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Wed, 11 Oct 2023 10:38:26 -0400 Subject: [PATCH 5/5] chore: changelog --- .changelog/33704.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changelog/33704.txt diff --git a/.changelog/33704.txt b/.changelog/33704.txt new file mode 100644 index 00000000000..37d05782fbc --- /dev/null +++ b/.changelog/33704.txt @@ -0,0 +1,6 @@ +```release-note:bug +resource/aws_db_parameter_group: Group names containing periods (`.`) no longer fail validation +``` +```release-note:bug +resource/aws_rds_cluster_parameter_group: Group names containing periods (`.`) no longer fail validation +```