From 1dab0ff0d7b0ea60ba64902dffd0dda95ec79d23 Mon Sep 17 00:00:00 2001 From: Claire Gaestel <213631+nyobe@users.noreply.github.com> Date: Fri, 28 Mar 2025 15:08:12 -0700 Subject: [PATCH 1/4] do not prefix input rotation docpaths with `values.` --- eval/eval.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eval/eval.go b/eval/eval.go index ad0ac554..ad6b191a 100644 --- a/eval/eval.go +++ b/eval/eval.go @@ -120,7 +120,7 @@ func RotateEnvironment( ) (*esc.Environment, *RotationResult, syntax.Diagnostics) { rotateDocPaths := make(map[string]bool, len(paths)) for _, path := range paths { - rotateDocPaths["values."+path.String()] = true + rotateDocPaths[path.String()] = true } return evalEnvironment(ctx, false, true, name, env, decrypter, providers, environments, execContext, true, rotateDocPaths) } From ba014dfdfc5f9a8a81c81a8bd6edbb07b79f2403 Mon Sep 17 00:00:00 2001 From: Claire Gaestel <213631+nyobe@users.noreply.github.com> Date: Fri, 28 Mar 2025 15:15:08 -0700 Subject: [PATCH 2/4] add the values prefix in the rotate CLI --- cmd/esc/cli/env_rotate.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/esc/cli/env_rotate.go b/cmd/esc/cli/env_rotate.go index d78890d0..11ceb9d7 100644 --- a/cmd/esc/cli/env_rotate.go +++ b/cmd/esc/cli/env_rotate.go @@ -5,6 +5,7 @@ package cli import ( "context" "fmt" + "slices" "strings" "github.com/pulumi/esc/cmd/esc/cli/client" @@ -39,11 +40,12 @@ func newEnvRotateCmd(envcmd *envCommand) *cobra.Command { rotationPaths := []string{} for _, arg := range args[1:] { - _, err := resource.ParsePropertyPath(arg) + path, err := resource.ParsePropertyPath(arg) if err != nil { return fmt.Errorf("'%s' is an invalid property path: %w", arg, err) } - rotationPaths = append(rotationPaths, arg) + path = slices.Insert(path, 0, "values") + rotationPaths = append(rotationPaths, path.String()) } resp, diags, err := envcmd.esc.client.RotateEnvironment(ctx, ref.orgName, ref.projectName, ref.envName, rotationPaths) From e847cef9a1da8615f6a5d1d09ec73680f5404e8e Mon Sep 17 00:00:00 2001 From: Claire Gaestel <213631+nyobe@users.noreply.github.com> Date: Fri, 28 Mar 2025 15:17:02 -0700 Subject: [PATCH 3/4] update test input --- eval/testdata/eval/rotate-paths/overrides.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eval/testdata/eval/rotate-paths/overrides.json b/eval/testdata/eval/rotate-paths/overrides.json index 8c21e8c7..51286cf3 100644 --- a/eval/testdata/eval/rotate-paths/overrides.json +++ b/eval/testdata/eval/rotate-paths/overrides.json @@ -1,8 +1,8 @@ { "rotate": true, "rotatePaths": [ - "examples[\"subscript-path\"][0]", - "examples.deeply.nested[0][\"quoted \\\"property\\\"\"].path", - "examples.embedded-in-another-fn[\"fn::open::test\"].some-input" + "values.examples[\"subscript-path\"][0]", + "values.examples.deeply.nested[0][\"quoted \\\"property\\\"\"].path", + "values.examples.embedded-in-another-fn[\"fn::open::test\"].some-input" ] } From b70cd4ec2f5304c27b1ed43a38dadd71ad825ef0 Mon Sep 17 00:00:00 2001 From: Claire Gaestel <213631+nyobe@users.noreply.github.com> Date: Fri, 28 Mar 2025 15:45:51 -0700 Subject: [PATCH 4/4] words --- cmd/esc/cli/env_rotate.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/esc/cli/env_rotate.go b/cmd/esc/cli/env_rotate.go index 11ceb9d7..a7cdccc0 100644 --- a/cmd/esc/cli/env_rotate.go +++ b/cmd/esc/cli/env_rotate.go @@ -44,6 +44,7 @@ func newEnvRotateCmd(envcmd *envCommand) *cobra.Command { if err != nil { return fmt.Errorf("'%s' is an invalid property path: %w", arg, err) } + // implicitly prefix the given path with the values top level key path = slices.Insert(path, 0, "values") rotationPaths = append(rotationPaths, path.String()) }