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

lightsail: Fix regex name validation #33405

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
39 changes: 39 additions & 0 deletions .changelog/33405.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
```release-note:bug
resource/aws_lightsail_certificate: Fix validation of `name`
```

```release-note:bug
resource/aws_lightsail_database: Fix validation of `name`
```

```release-note:bug
resource/aws_lightsail_disk: Fix validation of `name`
```

```release-note:bug
resource/aws_lightsail_instance: Fix validation of `name`
```

```release-note:bug
resource/aws_lightsail_lb: Fix validation of `lb_name`
```

```release-note:bug
resource/aws_lightsail_lb_attachment: Fix validation of `lb_name`
```

```release-note:bug
resource/aws_lightsail_lb_certificate: Fix validation of `lb_name`
```

```release-note:bug
resource/aws_lightsail_lb_certificate_attachment: Fix validation of `lb_name`
```

```release-note:bug
resource/aws_lightsail_lb_https_redirection_policy: Fix validation of `lb_name`
```

```release-note:bug
resource/aws_lightsail_lb_stickiness_policy: Fix validation of `lb_name`
```
2 changes: 1 addition & 1 deletion internal/service/lightsail/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func ResourceCertificate() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"subject_alternative_names": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func ResourceDatabase() *schema.Resource {
ForceNew: true,
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[_.^-]+[0-9A-Za-z-]+[_.^-]$`), "Must contain from 2 to 255 alphanumeric characters, or hyphens. The first and last character must be a letter or number"),
validation.StringMatch(regexache.MustCompile(`^[^_.-]+[0-9A-Za-z-]+[^_.-]$`), "Must contain from 2 to 255 alphanumeric characters, or hyphens. The first and last character must be a letter or number"),
),
},
"secondary_availability_zone": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func ResourceDisk() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"size_in_gb": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ResourceInstance() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z]`), "must begin with an alphanumeric character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"availability_zone": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func ResourceLoadBalancer() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"support_code": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/lb_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func ResourceLoadBalancerAttachment() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"instance_name": {
Expand Down
4 changes: 2 additions & 2 deletions internal/service/lightsail/lb_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func ResourceLoadBalancerCertificate() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"name": {
Expand All @@ -97,7 +97,7 @@ func ResourceLoadBalancerCertificate() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"subject_alternative_names": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/lb_certificate_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func ResourceLoadBalancerCertificateAttachment() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
"certificate_name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func ResourceLoadBalancerHTTPSRedirectionPolicy() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/service/lightsail/lb_stickiness_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func ResourceLoadBalancerStickinessPolicy() *schema.Resource {
ValidateFunc: validation.All(
validation.StringLenBetween(2, 255),
validation.StringMatch(regexache.MustCompile(`^[A-Za-z]`), "must begin with an alphabetic character"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[_.^-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+[^_.-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"),
),
},
},
Expand Down
Loading