Skip to content

Commit 2d4f4de

Browse files
committed
Merge remote-tracking branch 'origin/main' into stevenmasley/opts_validate
2 parents 154d86b + 6f500ca commit 2d4f4de

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

extract/parameter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func ParameterFromBlock(block *terraform.Block) (*types.Parameter, hcl.Diagnosti
5959
}
6060

6161
ftmeta := optionalString(block, "styling")
62-
formTypeMeta := make(map[string]any)
62+
var formTypeMeta types.ParameterStyling
6363
if ftmeta != "" {
6464
_ = json.Unmarshal([]byte(ftmeta), &formTypeMeta)
6565
}

extract/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ func ParameterFromState(block *tfjson.StateResource) (types.Parameter, error) {
5454
}
5555

5656
ftmeta := st.optionalString("styling")
57-
var formTypeMeta any
57+
var formTypeMeta types.ParameterStyling
5858
if ftmeta != "" {
5959
_ = json.Unmarshal([]byte(ftmeta), &formTypeMeta)
6060
} else {
61-
formTypeMeta = map[string]any{}
61+
formTypeMeta = types.ParameterStyling{}
6262
}
6363

6464
param := types.Parameter{

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/aquasecurity/trivy v0.58.2
88
github.com/coder/guts v1.0.2-0.20250227211802-139809366a22
99
github.com/coder/serpent v0.10.0
10-
github.com/coder/terraform-provider-coder/v2 v2.4.0-pre1.0.20250505161541-0fd96eeace73
10+
github.com/coder/terraform-provider-coder/v2 v2.4.0-pre1.0.20250506184715-e011f733bf27
1111
github.com/coder/websocket v1.8.13
1212
github.com/go-chi/chi v4.1.2+incompatible
1313
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
@@ -18,6 +18,7 @@ require (
1818
github.com/hashicorp/terraform-json v0.24.0
1919
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
2020
github.com/jedib0t/go-pretty/v6 v6.6.7
21+
github.com/quasilyte/go-ruleguard/dsl v0.3.22
2122
github.com/stretchr/testify v1.10.0
2223
github.com/zclconf/go-cty v1.16.2
2324
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
@@ -98,7 +99,6 @@ require (
9899
github.com/pion/udp v0.1.4 // indirect
99100
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
100101
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
101-
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
102102
github.com/rivo/uniseg v0.4.7 // indirect
103103
github.com/robfig/cron/v3 v3.0.1 // indirect
104104
github.com/samber/lo v1.49.1 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0 h1:3A0ES21Ke+FxEM8CXx
718718
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0/go.mod h1:5UuS2Ts+nTToAMeOjNlnHFkPahrtDkmpydBen/3wgZc=
719719
github.com/coder/serpent v0.10.0 h1:ofVk9FJXSek+SmL3yVE3GoArP83M+1tX+H7S4t8BSuM=
720720
github.com/coder/serpent v0.10.0/go.mod h1:cZFW6/fP+kE9nd/oRkEHJpG6sXCtQ+AX7WMMEHv0Y3Q=
721-
github.com/coder/terraform-provider-coder/v2 v2.4.0-pre1.0.20250505161541-0fd96eeace73 h1:Gax/pSsln9cSTueP5teoWM4EPqEux4BUp7VlECiuW2M=
722-
github.com/coder/terraform-provider-coder/v2 v2.4.0-pre1.0.20250505161541-0fd96eeace73/go.mod h1:2kaBpn5k9ZWtgKq5k4JbkVZG9DzEqR4mJSmpdshcO+s=
721+
github.com/coder/terraform-provider-coder/v2 v2.4.0-pre1.0.20250506184715-e011f733bf27 h1:CLJwMqst39+wfFehYQzVOiG5uXUtC5fbAZ3/EpxOWos=
722+
github.com/coder/terraform-provider-coder/v2 v2.4.0-pre1.0.20250506184715-e011f733bf27/go.mod h1:2kaBpn5k9ZWtgKq5k4JbkVZG9DzEqR4mJSmpdshcO+s=
723723
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
724724
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
725725
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=

site/src/types/preview.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export interface ParameterData {
3535
readonly type: ParameterType;
3636
// this is likely an enum in an external package "github.com/coder/terraform-provider-coder/v2/provider.ParameterFormType"
3737
readonly form_type: string;
38-
// empty interface{} type, falling back to unknown
39-
readonly styling: unknown;
38+
readonly styling: ParameterStyling;
4039
readonly mutable: boolean;
4140
readonly default_value: NullHCLString;
4241
readonly icon: string;
@@ -55,6 +54,13 @@ export interface ParameterOption {
5554
readonly icon: string;
5655
}
5756

57+
// From types/parameter.go
58+
export interface ParameterStyling {
59+
readonly placeholder?: string;
60+
readonly disabled?: boolean;
61+
readonly label?: string;
62+
}
63+
5864
// From types/enum.go
5965
export type ParameterType = "bool" | "list(string)" | "number" | "string";
6066

types/parameter.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type ParameterData struct {
5151
Description string `json:"description"`
5252
Type ParameterType `json:"type"`
5353
FormType provider.ParameterFormType `json:"form_type"`
54-
Styling any `json:"styling"`
54+
Styling ParameterStyling `json:"styling"`
5555
Mutable bool `json:"mutable"`
5656
DefaultValue HCLString `json:"default_value"`
5757
Icon string `json:"icon"`
@@ -76,6 +76,12 @@ type ParameterValidation struct {
7676
Monotonic *string `json:"validation_monotonic"`
7777
}
7878

79+
type ParameterStyling struct {
80+
Placeholder *string `json:"placeholder,omitempty"`
81+
Disabled *bool `json:"disabled,omitempty"`
82+
Label *string `json:"label,omitempty"`
83+
}
84+
7985
type ParameterOption struct {
8086
Name string `json:"name"`
8187
Description string `json:"description"`

0 commit comments

Comments
 (0)