Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(cli): add --var shorthand for --variable #8710

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

Merged
merged 1 commit into from
Jul 25, 2023
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
5 changes: 5 additions & 0 deletions cli/templatecreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
Description: "Specify a set of values for Terraform-managed variables.",
Value: clibase.StringArrayOf(&variables),
},
{
Flag: "var",
Description: "Alias of --variable.",
Value: clibase.StringArrayOf(&variables),
},
{
Flag: "provisioner-tag",
Description: "Specify a set of tags to target provisioner daemons.",
Expand Down
5 changes: 5 additions & 0 deletions cli/templatepush.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
Description: "Specify a set of values for Terraform-managed variables.",
Value: clibase.StringArrayOf(&variables),
},
{
Flag: "var",
Description: "Alias of --variable.",
Value: clibase.StringArrayOf(&variables),
},
{
Flag: "provisioner-tag",
Description: "Specify a set of tags to target provisioner daemons.",
Expand Down
3 changes: 3 additions & 0 deletions cli/testdata/coder_templates_create_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Create a template from the current directory or as specified by flag
--provisioner-tag string-array
Specify a set of tags to target provisioner daemons.

--var string-array
Alias of --variable.

--variable string-array
Specify a set of values for Terraform-managed variables.

Expand Down
3 changes: 3 additions & 0 deletions cli/testdata/coder_templates_push_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Push a new template version from the current directory or as specified by flag
--provisioner-tag string-array
Specify a set of tags to target provisioner daemons.

--var string-array
Alias of --variable.

--variable string-array
Specify a set of values for Terraform-managed variables.

Expand Down
8 changes: 8 additions & 0 deletions docs/cli/templates_create.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/cli/templates_push.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/platforms/jfrog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ provider "artifactory" {
}
```

When pushing the template, you can pass in the variables using the `--variable` flag:
When pushing the template, you can pass in the variables using the `-V` flag:

```sh
coder templates push --variable 'jfrog_url=https://YYY.jfrog.io' --variable 'artifactory_access_token=XXX'
coder templates push --var 'jfrog_url=https://YYY.jfrog.io' --var 'artifactory_access_token=XXX'
```

## Installing jf
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/envbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ Coder. Consult the [migration](https://coder.com/docs/v2/latest/templates/parame
documentation for details on how to do so.

To supply values to existing existing Terraform variables you can specify the
`--variable` flag. For example
`-V` flag. For example

```bash
coder templates create envbox --variable namespace="mynamespace" --variable max_cpus=2 --variable min_cpus=1 --variable max_memory=4 --variable min_memory=1
coder templates create envbox --var namespace="mynamespace" --var max_cpus=2 --var min_cpus=1 --var max_memory=4 --var min_memory=1
```

## Contributions
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/fly-docker-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ This template provisions a [code-server](https://github.com/coder/code-server) i

```bash
coder templates create fly-docker-image \
--variable fly_api_token=$(flyctl auth token) \
--variable fly_org=personal
--var fly_api_token=$(flyctl auth token) \
--var fly_org=personal
```

> If the Coder server is also running as a fly.io app, then instead of setting variable `fly_api_token` you can also set a fly.io secret with the name `FLY_API_TOKEN`
Expand Down