Skip to content
Open
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
7 changes: 5 additions & 2 deletions cmd/esc/cli/env_rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package cli
import (
"context"
"fmt"
"slices"
"strings"

"github.com/pulumi/esc/cmd/esc/cli/client"
Expand Down Expand Up @@ -39,11 +40,13 @@ 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)
// implicitly prefix the given path with the values top level key
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)
Expand Down
2 changes: 1 addition & 1 deletion eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions eval/testdata/eval/rotate-paths/overrides.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
Loading