---
page_title: 'Plugin Development - Framework: Function Parameters'
description: >-
  Learn the function parameter types in the provider development framework.
  Parameters are positional data arguments in a function definition.
---

# Parameters

Parameters in [function definitions](/terraform/plugin/framework/functions/implementation#definition-method) describes how data values are passed to the function logic. Every parameter type has an associated [value type](/terraform/plugin/framework/handling-data/types), although this data handling is simplified for function implementations over other provider concepts, such as resource implementations.

## Available Parameter Types

Function definitions support the following parameter types:

- [Primitive](#primitive-parameter-types): Parameter that accepts a single value, such as a boolean, number, or string.
- [Collection](#collection-parameter-types): Parameter that accepts multiple values of a single element type, such as a list, map, or set.
- [Object](#object-parameter-type): Parameter that accepts a structure of explicit attribute names.
- [Dynamic](#dynamic-parameter-type): Parameter that accepts any value type.

### Primitive Parameter Types

Parameter types that accepts a single data value, such as a boolean, number, or string.

| Parameter Type | Use Case |
|----------------|----------|
| [Bool](/terraform/plugin/framework/functions/parameters/bool) | Boolean true or false |
| [Float32](/terraform/plugin/framework/functions/parameters/float32) | 32-bit floating point number |
| [Float64](/terraform/plugin/framework/functions/parameters/float64) | 64-bit floating point number |
| [Int32](/terraform/plugin/framework/functions/parameters/int32) | 32-bit integer number |
| [Int64](/terraform/plugin/framework/functions/parameters/int64) | 64-bit integer number |
| [Number](/terraform/plugin/framework/functions/parameters/number) | Arbitrary precision (generally over 64-bit, up to 512-bit) number |
| [String](/terraform/plugin/framework/functions/parameters/string) | Collection of UTF-8 encoded characters |

### Collection Parameter Types

Parameter types that accepts multiple values of a single element type, such as a list, map, or set.

| Parameter Type | Use Case |
|----------------|----------|
| [List](/terraform/plugin/framework/functions/parameters/list) | Ordered collection of single element type |
| [Map](/terraform/plugin/framework/functions/parameters/map) | Mapping of arbitrary string keys to values of single element type |
| [Set](/terraform/plugin/framework/functions/parameters/set) | Unordered, unique collection of single element type |

### Object Parameter Type

Parameter type that accepts a structure of explicit attribute names.

| Parameter Type | Use Case |
|----------------|----------|
| [Object](/terraform/plugin/framework/functions/parameters/object) | Single structure mapping explicit attribute names |

### Dynamic Parameter Type

<Note>

Dynamic value handling is an advanced use case. Prefer static parameter types when possible unless absolutely necessary for your use case.

</Note>

Parameter that accepts any value type, determined by Terraform at runtime.

| Parameter Type | Use Case |
|----------------|----------|
| [Dynamic](/terraform/plugin/framework/functions/parameters/dynamic) | Accept any value type of data, determined at runtime. |

## Parameter Naming

All parameter types have a `Name` field that is **required**.

### Missing Parameter Names

Attempting to use unnamed parameters will generate runtime errors of the following form:

```text
│ Error: Failed to load plugin schemas
│
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for provider registry.terraform.io/cloud_provider/cloud_resource: failed to
│ retrieve schema from provider "registry.terraform.io/cloud_provider/cloud_resource": Invalid Function Definition: When validating the function definition, an implementation issue was
│ found. This is always an issue with the provider and should be reported to the provider developers.
│
│ Function "example_function" - Parameter at position 0 does not have a name.
```

### Parameter Errors

Parameter names are used in runtime errors to highlight which parameter is causing the issue. For example, using a value that is incompatible with the parameter type will generate an error message such as the following:

```text
│ Error: Invalid function argument
│
│   on resource.tf line 10, in resource "example_resource" "example":
│   10:   configurable_attribute = provider::example::example_function("string")
│     ├────────────────
│     │ while calling provider::example::example_function(bool_param)
│
│ Invalid value for "bool_param" parameter: a bool is required.
```

## Parameter Validation

Validation handling for provider-defined function parameters can be enabled by using [custom types](/terraform/plugin/framework/handling-data/types/custom#validation).

Implement the [`function.ValidateableParameter` interface](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/function#ValidateableParameter) on the custom value type to define and enable validation handling for a provider-defined function parameter, which will automatically raise an error when a value is determined to be invalid.

```go
// Implementation of the function.ValidateableParameter interface
func (v CustomStringValue) ValidateParameter(ctx context.Context, req function.ValidateParameterRequest, resp *function.ValidateParameterResponse) {
    if v.IsNull() || v.IsUnknown() {
        return
    }

    _, err := time.Parse(time.RFC3339, v.ValueString())

    if err != nil {
        resp.Error = function.NewArgumentFuncError(
            req.Position,
            "Invalid RFC 3339 String Value: "+
                "An unexpected error occurred while converting a string value that was expected to be RFC 3339 format. "+
                "The RFC 3339 string format is YYYY-MM-DDTHH:MM:SSZ, such as 2006-01-02T15:04:05Z or 2006-01-02T15:04:05+07:00.\n\n"+
                fmt.Sprintf("Position: %d", req.Position)+"\n"+
                "Given Value: "+v.ValueString()+"\n"+
                "Error: "+err.Error(),
        )
    }
}
```

Refer to [Custom Types](/terraform/plugin/framework/handling-data/types/custom) for further details on creating provider-defined types and values