Do not ask for a passphrase in non-interactive sessions (#3204)

* Do not ask for a passphrase in non-interactive sessions. Fail with a hint to set the environment variable.

* Changelog
This commit is contained in:
Mikhail Shilkov 2019-09-10 22:25:57 +02:00 committed by Pat Gavlin
parent 6c9556fe78
commit 7b3a7c6253
2 changed files with 6 additions and 0 deletions

View file

@ -9,6 +9,8 @@ CHANGELOG
[#3197](https://github.com/pulumi/pulumi/pull/3197)
- Increase the MaxCallRecvMsgSize for interacting with the gRPC server.
[#3201](https://github.com/pulumi/pulumi/pull/3201)
- Do not ask for a passphrase in non-interactive sessions (fix [#2758](https://github.com/pulumi/pulumi/issues/2758)).
[#3204](https://github.com/pulumi/pulumi/pull/3204)
- Support combining the filestate backend (local or remote storage) with the cloud-backed secrets providers (KMS, etc.).
[#3198](https://github.com/pulumi/pulumi/pull/3198)

View file

@ -16,6 +16,7 @@ package cmd
import (
cryptorand "crypto/rand"
"encoding/base64"
"errors"
"fmt"
"os"
@ -33,6 +34,9 @@ func readPassphrase(prompt string) (string, error) {
if phrase, ok := os.LookupEnv("PULUMI_CONFIG_PASSPHRASE"); ok {
return phrase, nil
}
if !cmdutil.Interactive() {
return "", errors.New("passphrase must be set with PULUMI_CONFIG_PASSPHRASE environment variable")
}
return cmdutil.ReadConsoleNoEcho(prompt)
}