Skip to content

Support parameter-based validator interfaces <Type>ParameterValidator #235

@shrsr

Description

@shrsr

Module version

github.com/hashicorp/terraform-plugin-framework v1.10.0

The following snippet in the documentation https://github.com/hashicorp/terraform-plugin-framework/blob/v1.10.0/website/docs/plugin/framework/validation.mdx under the section Parameter Validation doesn't work as expected.

// Typically within the function.Definition for a function.
function.StringParameter{
    // ... other Parameter configuration ...

    Validators: []function.StringParameterValidator{
        stringvalidator.LengthBetween(10, 256),
    },
},

Actual Behavior

Error Message:
cannot use stringvalidator.LengthBetween() (value of type validator.String) as function.StringParameterValidator value in array or slice literal: validator.String does not implement function.StringParameterValidator (missing method ValidateParameterString)

Additionally, I would like to know if there are any plans to support functions under stringvalidator in the function.StringParameter in the future?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions