Uses the `cliui` output helpers from #30508. `coder provisioner keys create` printed the new key's secret as prose, so scripts provisioning external provisioners had to scrape it and look up the key's ID and tags separately. It now accepts `-o text|json`. JSON is the key as `provisioner keys list` shows it (ID, name, organization, tags, created at) plus the one-time `key`. **Behavior change:** Additive. Default text output is unchanged. The command now fetches the new key's metadata with the returned secret (`GET /api/v2/provisionerkeys/{key}`). If that fails, it prints a warning to stderr, falls back to the name, organization and tags it sent (leaving `id` and `created_at` unset), and still outputs the secret. <details> <summary>Decisions</summary> - `CreateProvisionerKey` only returns the secret, so the key's metadata comes from `GetProvisionerKey(secret)`, the same lookup `coder provisioner start` uses. This replaced an earlier list-and-match-by-name approach, per review. - A failed lookup never fails the command, because the key already exists and the secret can't be shown again. </details> Closes [CLI-36](https://linear.app/codercom/issue/CLI-36) _This PR was generated by Coder Agents on behalf of @nickvigilante._ --------- Co-authored-by: Jeremy Ruppel <jeremyruppel@users.noreply.github.com>
20 lines
440 B
Plaintext
20 lines
440 B
Plaintext
coder v0.0.0-devel
|
|
|
|
USAGE:
|
|
coder provisioner keys create [flags] <name>
|
|
|
|
Create a new provisioner key
|
|
|
|
OPTIONS:
|
|
-O, --org string, $CODER_ORGANIZATION
|
|
Select which organization (uuid or name) to use.
|
|
|
|
-o, --output text|json (default: text)
|
|
Output format.
|
|
|
|
-t, --tag string-array, $CODER_PROVISIONERD_TAGS
|
|
Tags to filter provisioner jobs by.
|
|
|
|
———
|
|
Run `coder --help` for a list of global options.
|