Skip to content

Commit

Permalink
Merge a87a7eb into backport/fix/s3-backend-kms-alias/immensely-ample-…
Browse files Browse the repository at this point in the history
…pika
  • Loading branch information
teamterraform authored Oct 9, 2023
2 parents 49291d2 + a87a7eb commit f803b3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/backend/remote-state/s3/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
const (
multiRegionKeyIdPattern = `mrk-[a-f0-9]{32}`
uuidRegexPattern = `[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[ab89][a-f0-9]{3}-[a-f0-9]{12}`
aliasRegexPattern = `alias/(.*)`
aliasRegexPattern = `alias/[a-zA-Z0-9/_-]+`
)

func validateKMSKey(path cty.Path, s string) (diags tfdiags.Diagnostics) {
Expand Down Expand Up @@ -86,7 +86,7 @@ func keyIdFromARNResource(s string) string {
}

func aliasIdFromARNResource(s string) string {
aliasIdResourceRegex := regexp.MustCompile(`^` + aliasRegexPattern + `$`)
aliasIdResourceRegex := regexp.MustCompile(`^(` + aliasRegexPattern + `)$`)
matches := aliasIdResourceRegex.FindStringSubmatch(s)
if matches == nil || len(matches) != 2 {
return ""
Expand Down

0 comments on commit f803b3f

Please sign in to comment.