From 262ef6251df0f2b70cbf70806179a8809e49b0d1 Mon Sep 17 00:00:00 2001 From: srinandan <13950006+srinandan@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:55:36 -0700 Subject: [PATCH] bug: fixes regex for cloudkms #137 --- cmd/provision/provision.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/provision/provision.go b/cmd/provision/provision.go index 1544c425..98860d28 100644 --- a/cmd/provision/provision.go +++ b/cmd/provision/provision.go @@ -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}") } }