Skip to content

Commit 6952dfd

Browse files
committed
Minor refactorings, corrections
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 58cbd83 commit 6952dfd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

codersdk/richparameters_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,13 @@ func TestRichParameterValidation(t *testing.T) {
201201

202202
monotonicIncreasingNumberRichParameters := []codersdk.TemplateVersionParameter{
203203
{Name: stringParameterName, Type: "string", Mutable: true},
204-
{Name: numberParameterName, Type: "number", Mutable: true, ValidationMin: ptr.Ref(int32(3)), ValidationMax: ptr.Ref(int32(100)), ValidationMonotonic: "increasing"},
204+
{Name: numberParameterName, Type: "number", Mutable: true, ValidationMin: ptr.Ref(int32(3)), ValidationMax: ptr.Ref(int32(100)), ValidationMonotonic: codersdk.MonotonicOrderIncreasing},
205205
{Name: boolParameterName, Type: "bool", Mutable: true},
206206
}
207207

208208
monotonicDecreasingNumberRichParameters := []codersdk.TemplateVersionParameter{
209209
{Name: stringParameterName, Type: "string", Mutable: true},
210-
{Name: numberParameterName, Type: "number", Mutable: true, ValidationMin: ptr.Ref(int32(3)), ValidationMax: ptr.Ref(int32(100)), ValidationMonotonic: "decreasing"},
210+
{Name: numberParameterName, Type: "number", Mutable: true, ValidationMin: ptr.Ref(int32(3)), ValidationMax: ptr.Ref(int32(100)), ValidationMonotonic: codersdk.MonotonicOrderDecreasing},
211211
{Name: boolParameterName, Type: "bool", Mutable: true},
212212
}
213213

codersdk/templateversions.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"time"
1010

11+
"github.com/coder/terraform-provider-coder/provider"
1112
"github.com/google/uuid"
1213
)
1314

@@ -47,8 +48,8 @@ type TemplateVersionExternalAuth struct {
4748
type ValidationMonotonicOrder string
4849

4950
const (
50-
MonotonicOrderIncreasing ValidationMonotonicOrder = "increasing"
51-
MonotonicOrderDecreasing ValidationMonotonicOrder = "decreasing"
51+
MonotonicOrderIncreasing ValidationMonotonicOrder = provider.ValidationMonotonicIncreasing
52+
MonotonicOrderDecreasing ValidationMonotonicOrder = provider.ValidationMonotonicDecreasing
5253
)
5354

5455
// TemplateVersionParameter represents a parameter for a template version.

docs/templates/parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ monotonic numbers, and regular expressions.
233233
You can limit a `number` parameter to `min` and `max` boundaries.
234234

235235
You can also specify its monotonicity as `increasing` or `decreasing` to verify
236-
the current and new values. Use the `monotonic` aatribute for resources that
236+
the current and new values. Use the `monotonic` attribute for resources that
237237
can't be shrunk or grown without implications, like disk volume size.
238238

239239
```hcl

0 commit comments

Comments
 (0)