hashicorp / hashicorp/terraform-plugin-framework

Create Learn Collection for Custom Attribute Types

Open
#512 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Go
Stars
384
Forks
107
Avg merge
3m
Merged PRs (30d)
1

Description

### Module version

```
v0.14.0
```

### Use-cases

Provider developers utilizing the framework can implement custom attribute types, which can simplify schema implementations across many data sources and resources in a single provider. These custom attribute types can also be generally applicable to the entire provider ecosystem, for example, a RFC3339 timestamp string attribute type that automatically provides configuration validation and makes a known value easier to access as a `time.Time` type.

Creating custom attribute types generally involves implementing _at least_ the `attr.Type` and `attr.Value` interfaces. Advanced types may implement additional interfaces such as `xattr.TypeWithValidate` and (in the future) `xattr.TypeWithPlanModifier` to remove the need for schemas to repeat these validation and plan modification definitions everywhere. On the value side, it generally means updating the modeled value type for the field/attribute. Gluing everything together may be non-intuitive in reference documentation form.

### Attempted Solutions

Asking provider developers to read the schema/attribute documentation which briefly mentions custom attribute types and the associated interfaces.

### Proposal

Since this functionality is powerful for provider developers and has multiple moving parts, it seems ideal to create a Learn collection which walks through the process of using and then creating custom attribute types.

### References

- https://learn.hashicorp.com/collections/terraform/providers-plugin-framework

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.