Skip to content

Commit 5524c10

Browse files
committed
test: parameter description contains Markdown
1 parent 692d23b commit 5524c10

File tree

3 files changed

+31
-42
lines changed

3 files changed

+31
-42
lines changed

examples/resources/coder_parameter/resource.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ data "coder_parameter" "example" {
1717

1818
data "coder_parameter" "ami" {
1919
name = "Machine Image"
20-
description = "Provide the machine image."
21-
description_markdown = <<-EOT
22-
# Select the machine image
20+
description = <<-EOT
21+
# Provide the machine image
2322
See the [registry](https://container.registry.blah/namespace) for options.
2423
EOT
2524
option {

provider/parameter.go

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ const (
3939
)
4040

4141
type Parameter struct {
42-
Value string
43-
Name string
44-
Description string
45-
DescriptionMarkdown string
46-
Type string
47-
Mutable bool
48-
Default string
49-
Icon string
50-
Option []Option
51-
Validation []Validation
42+
Value string
43+
Name string
44+
Description string
45+
Type string
46+
Mutable bool
47+
Default string
48+
Icon string
49+
Option []Option
50+
Validation []Validation
5251
}
5352

5453
func parameterDataSource() *schema.Resource {
@@ -59,27 +58,25 @@ func parameterDataSource() *schema.Resource {
5958

6059
var parameter Parameter
6160
err := mapstructure.Decode(struct {
62-
Value interface{}
63-
Name interface{}
64-
Description interface{}
65-
DescriptionMarkdown interface{}
66-
Type interface{}
67-
Mutable interface{}
68-
Default interface{}
69-
Icon interface{}
70-
Option interface{}
71-
Validation interface{}
61+
Value interface{}
62+
Name interface{}
63+
Description interface{}
64+
Type interface{}
65+
Mutable interface{}
66+
Default interface{}
67+
Icon interface{}
68+
Option interface{}
69+
Validation interface{}
7270
}{
73-
Value: rd.Get("value"),
74-
Name: rd.Get("name"),
75-
Description: rd.Get("description"),
76-
DescriptionMarkdown: rd.Get("description_markdown"),
77-
Type: rd.Get("type"),
78-
Mutable: rd.Get("mutable"),
79-
Default: rd.Get("default"),
80-
Icon: rd.Get("icon"),
81-
Option: rd.Get("option"),
82-
Validation: rd.Get("validation"),
71+
Value: rd.Get("value"),
72+
Name: rd.Get("name"),
73+
Description: rd.Get("description"),
74+
Type: rd.Get("type"),
75+
Mutable: rd.Get("mutable"),
76+
Default: rd.Get("default"),
77+
Icon: rd.Get("icon"),
78+
Option: rd.Get("option"),
79+
Validation: rd.Get("validation"),
8380
}, &parameter)
8481
if err != nil {
8582
return diag.Errorf("decode parameter: %s", err)
@@ -145,11 +142,6 @@ func parameterDataSource() *schema.Resource {
145142
Optional: true,
146143
Description: "Describe what this parameter does.",
147144
},
148-
"description_markdown": {
149-
Type: schema.TypeString,
150-
Optional: true,
151-
Description: "Alternative description with Markdown tags.",
152-
},
153145
"type": {
154146
Type: schema.TypeString,
155147
Default: "string",

provider/parameter_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ func TestParameter(t *testing.T) {
2424
data "coder_parameter" "region" {
2525
name = "Region"
2626
type = "string"
27-
description = "Some option!"
28-
description_markdown = <<-EOT
27+
description = <<-EOT
2928
# Select the machine image
3029
See the [registry](https://container.registry.blah/namespace) for options.
3130
EOT
@@ -50,8 +49,7 @@ data "coder_parameter" "region" {
5049
for key, value := range map[string]interface{}{
5150
"name": "Region",
5251
"type": "string",
53-
"description": "Some option!",
54-
"description_markdown": "# Select the machine image\nSee the [registry](https://container.registry.blah/namespace) for options.\n",
52+
"description": "# Select the machine image\nSee the [registry](https://container.registry.blah/namespace) for options.\n",
5553
"mutable": "true",
5654
"icon": "/icon/region.svg",
5755
"option.0.name": "US Central",

0 commit comments

Comments
 (0)