Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions codersdk/richparameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ func TestRichParameterValidation(t *testing.T) {

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

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

Expand Down
5 changes: 3 additions & 2 deletions codersdk/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/http"
"time"

"github.com/coder/terraform-provider-coder/provider"
"github.com/google/uuid"
)

Expand Down Expand Up @@ -47,8 +48,8 @@ type TemplateVersionExternalAuth struct {
type ValidationMonotonicOrder string

const (
MonotonicOrderIncreasing ValidationMonotonicOrder = "increasing"
MonotonicOrderDecreasing ValidationMonotonicOrder = "decreasing"
MonotonicOrderIncreasing ValidationMonotonicOrder = provider.ValidationMonotonicIncreasing
MonotonicOrderDecreasing ValidationMonotonicOrder = provider.ValidationMonotonicDecreasing
)

// TemplateVersionParameter represents a parameter for a template version.
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ monotonic numbers, and regular expressions.
You can limit a `number` parameter to `min` and `max` boundaries.

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

```hcl
Expand Down