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

How to set a secret that starts with - using pulumi config set --secret ? #12458

Closed
Jeff-Tian opened this issue Aug 6, 2024 · 1 comment
Closed
Labels
needs-triage Needs attention from the triage team

Comments

@Jeff-Tian
Copy link

File: content/docs/cli/commands/pulumi_config_set.md

I need to set a secret generated by Azure, and it happened to start with a dash -, for example: -FM8QW.Jkf6qUvIkpQFFnio74nhxo (This is an example value; I don't use it in the real scenario now).

But the pulumi config set—-secret with that secret value always fails, no matter how I try to wrap it with double or single quotes. I can't find any helpful messages in the documentation.

I tried the following commands, but all of them failed:

pulumi config set --secret my-secret -FM8Q~W.Jkf6qUvIkpQFFnio
pulumi config set --secret my-secret '-FM8Q~W.Jkf6qUvIkpQFFnio'
pulumi config set --secret my-secret "-FM8Q~W.Jkf6qUvIkpQFFnio"

The error message indicates that the pulumi config set command is misinterpreting the secret value as a flag due to the leading hyphen (-). The error messages were like the following:

pulumi config set --secret my-secret "-FM8Q~W.Jkf6qUvIkpQFFnio"
Error: unknown shorthand flag: 'F' in -FM8Q~W.Jkf6qUvIkpQFFnio74nhxo
Usage:
  pulumi config set <key> [value] [flags]

Flags:
  -h, --help        help for set
      --path        The key contains a path to a property in a map or list to set
      --plaintext   Save the value as plaintext (unencrypted)
      --secret      Encrypt the value instead of storing it in plaintext

Global Flags:
      --color string                 Colorize output. Choices are: always, never, raw, auto (default "auto")
      --config-file string           Use the configuration values in the specified file rather than detecting the file name
  -C, --cwd string                   Run pulumi as if it had been started in another directory
      --disable-integrity-checking   Disable integrity checking of checkpoint files
  -e, --emoji                        Enable emojis in the output (default true)
  -Q, --fully-qualify-stack-names    Show fully-qualified stack names
      --logflow                      Flow log settings to child processes (like plugins)
      --logtostderr                  Log to stderr instead of to files
      --memprofilerate int           Enable more precise (and expensive) memory allocation profiles by setting runtime.MemProfileRate
      --non-interactive              Disable interactive mode for all commands
      --profiling string             Emit CPU and memory profiles and an execution trace to '[filename].[pid].{cpu,mem,trace}', respectively
  -s, --stack string                 The name of the stack to operate on. Defaults to the current stack
      --tracing file:                Emit tracing to the specified endpoint. Use the file: scheme to write tracing data to a local file
  -v, --verbose int                  Enable verbose logging (e.g., v=3); anything >3 is very verbose

An error occurred: unknown shorthand flag: 'F' in -FM8Q~W.Jkf6qUvIkpQFFnio
@github-actions github-actions bot added the needs-triage Needs attention from the triage team label Aug 6, 2024
@github-project-automation github-project-automation bot moved this to 🤔 Triage in Docs 📚 Aug 6, 2024
@Jeff-Tian
Copy link
Author

Tried this is working, maybe we can add to the documentation:

pulumi config set --secret my-secret -- '-FM8Q~W.Jkf6qUvIkpQFFnio'

@github-project-automation github-project-automation bot moved this from 🤔 Triage to 🏁 Done in Docs 📚 Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Needs attention from the triage team
Projects
Status: 🏁 Done
Development

No branches or pull requests

1 participant