Skip to content

Commit

Permalink
bug: fixes regex for cloudkms #137
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Oct 3, 2023
1 parent 0e5e6ff commit 262ef62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/provision/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ var Cmd = &cobra.Command{
serviceAccount := cmd.Flag("service-account").Value.String()

if cloudKMS != "" {
re := regexp.MustCompile(`locations\/([a-zA-Z0-9_-]+)\/keyRings\/([a-zA-Z0-9_-]+)\/cryptoKeys\/([a-zA-Z0-9_-]+)`)
re := regexp.MustCompile(`projects\/([a-zA-Z0-9_-]+)\/locations\/([a-zA-Z0-9_-]+)\/keyRings\/([a-zA-Z0-9_-]+)\/cryptoKeys\/([a-zA-Z0-9_-]+)\/cryptoKeyVersions\/([0-9]+)`)
ok := re.Match([]byte(cloudKMS))
if !ok {
return fmt.Errorf("CloudKMS key must be of the format " +
"locations/{location}/keyRings/{test}/cryptoKeys/{cryptoKey}")
"projects/{project}/locations/{location}/keyRings/{test}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}")
}
}

Expand Down

0 comments on commit 262ef62

Please sign in to comment.