Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure pulumi history marks secrets that can't be un-encrypted as such #5701

Merged
merged 2 commits into from
Nov 6, 2020
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ CHANGELOG

## HEAD (Unreleased)

- [cli] Ensure `pulumi history` annotes when secrets are unable to be decrypted
[#5701](https://github.com/pulumi/pulumi/pull/5701)

- Fix a bug in the Python SDK that caused incompatibilities with versions of the CLI prior to
2.13.0.
[#5702](https://github.com/pulumi/pulumi/pull/5702)
Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/pulumi/stack_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/pulumi/pulumi/sdk/v2/go/common/util/cmdutil"
)

const errorDecryptingValue = "ERROR_UNABLE_TO_DECRYPT"

func newStackHistoryCmd() *cobra.Command {
var stack string
var jsonOut bool
Expand Down Expand Up @@ -109,9 +111,12 @@ func displayUpdatesJSON(updates []backend.UpdateInfo, decrypter config.Decrypter
if !v.Secure() || (v.Secure() && decrypter != nil) {
value, err := v.Value(decrypter)
if err != nil {
return err
// We don't actually want to error here
// we are just going to mark as "UNKNOWN" and then let the command continue
configValue.Value = makeStringRef(errorDecryptingValue)
} else {
configValue.Value = makeStringRef(value)
}
configValue.Value = makeStringRef(value)

if v.Object() {
var obj interface{}
Expand All @@ -121,7 +126,6 @@ func displayUpdatesJSON(updates []backend.UpdateInfo, decrypter config.Decrypter
configValue.ObjectValue = obj
}
}

info.Config[k.String()] = configValue
}
info.Result = string(update.Result)
Expand Down