mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(docs): document how to correctly override list(string) parameters (#15497)
- Adds documentation for how to correctly hold --parameter with list(string) - Adds tests for the aforementioned documented correct finger positions for --parameter list(string)
This commit is contained in:
@@ -79,6 +79,31 @@ data "coder_parameter" "security_groups" {
|
||||
}
|
||||
```
|
||||
|
||||
> [!NOTE] Overriding a `list(string)` on the CLI is tricky because:
|
||||
>
|
||||
> - `--parameter "parameter_name=parameter_value"` is parsed as CSV.
|
||||
> - `parameter_value` is parsed as JSON.
|
||||
>
|
||||
> So, to properly specify a `list(string)` with the `--parameter` CLI argument,
|
||||
> you will need to take care of both CSV quoting and shell quoting.
|
||||
>
|
||||
> For the above example, to override the default values of the `security_groups`
|
||||
> parameter, you will need to pass the following argument to `coder create`:
|
||||
>
|
||||
> ```
|
||||
> --parameter "\"security_groups=[\"\"DevOps Security Group\"\",\"\"Backend Security Group\"\"]\""
|
||||
> ```
|
||||
>
|
||||
> Alternatively, you can use `--rich-parameter-file` to work around the above
|
||||
> issues. This allows you to specify parameters as YAML. An equivalent parameter
|
||||
> file for the above `--parameter` is provided below:
|
||||
>
|
||||
> ```yaml
|
||||
> security_groups:
|
||||
> - DevOps Security Group
|
||||
> - Backend Security Group
|
||||
> ```
|
||||
|
||||
## Options
|
||||
|
||||
A `string` parameter can provide a set of options to limit the user's choices:
|
||||
|
||||
Reference in New Issue
Block a user