Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add display_name to coder_parameter#118

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 1 commit intocoder:mainfrommtojek:6852-add-display-name
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes fromall 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
3 changes: 2 additions & 1 deletiondocs/data-sources/parameter.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,12 +17,13 @@ Use this data source to configure editable options for workspaces.

### Required

- `name` (String) The name of the parameter as it will appear in the interface. If this is changed, developers will be re-prompted for a new value.
- `name` (String) The name of the parameter. If this is changed, developers will be re-prompted for a new value.

### Optional

- `default` (String) A default value for the parameter.
- `description` (String) Describe what this parameter does.
- `display_name` (String) The displayed name of the parameter as it will appear in the interface.
- `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a built-in icon with `data.coder_workspace.me.access_url + "/icon/<path>"`.
- `legacy_variable` (String) Reference to the Terraform variable. Coder will use it to lookup the default value.
- `legacy_variable_name` (String) Name of the legacy Terraform variable. Coder will use it to lookup the variable value.
Expand Down
7 changes: 4 additions & 3 deletionsexamples/resources/coder_parameter/resource.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,7 +77,8 @@ data "coder_parameter" "fairy_tale" {
}

data "coder_parameter" "users" {
name = "System users"
type = "list(string)"
default = jsonencode(["root", "user1", "user2"])
name = "system_users"
display_name = "System users"
type = "list(string)"
default = jsonencode(["root", "user1", "user2"])
}
10 changes: 9 additions & 1 deletionprovider/parameter.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,7 @@ const (
type Parameter struct {
Value string
Name string
DisplayName string
Description string
Type string
Mutable bool
Expand All@@ -65,6 +66,7 @@ func parameterDataSource() *schema.Resource {
err := mapstructure.Decode(struct {
Value interface{}
Name interface{}
DisplayName interface{}
Description interface{}
Type interface{}
Mutable interface{}
Expand All@@ -79,6 +81,7 @@ func parameterDataSource() *schema.Resource {
}{
Value: rd.Get("value"),
Name: rd.Get("name"),
DisplayName: rd.Get("display_name"),
Description: rd.Get("description"),
Type: rd.Get("type"),
Mutable: rd.Get("mutable"),
Expand DownExpand Up@@ -170,7 +173,12 @@ func parameterDataSource() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
Description: "The name of the parameter as it will appear in the interface. If this is changed, developers will be re-prompted for a new value.",
Description: "The name of the parameter. If this is changed, developers will be re-prompted for a new value.",
},
"display_name": {
Type: schema.TypeString,
Optional: true,
Description: "The displayed name of the parameter as it will appear in the interface.",
},
"description": {
Type: schema.TypeString,
Expand Down
6 changes: 4 additions & 2 deletionsprovider/parameter_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,8 @@ func TestParameter(t *testing.T) {
Name: "FieldsExist",
Config: `
data "coder_parameter" "region" {
name = "Region"
name = "region"
display_name = "Region"
type = "string"
description = <<-EOT
# Select the machine image
Expand All@@ -47,7 +48,8 @@ func TestParameter(t *testing.T) {
Check: func(state *terraform.ResourceState) {
attrs := state.Primary.Attributes
for key, value := range map[string]interface{}{
"name": "Region",
"name": "region",
"display_name": "Region",
"type": "string",
"description": "# Select the machine image\nSee the [registry](https://container.registry.blah/namespace) for options.\n",
"mutable": "true",
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp