hashicorp / hashicorp/terraform-plugin-framework-validators
Consider Per-Type NotNull/Required Validators
- Dominant language
- Go
- Stars
- 28
- Forks
- 13
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 1
Description
### Terraform CLI and Framework Versions
Any Terraform or terraform-plugin-framework version.
### Use Cases or Problem Statement
There are cases with nested attributes where setting the parent attribute as `Computed: true` and any underlying attributes to `Required: true` is invalid. The framework should likely be raising a sort of implementation error in this situation, which might occur in the future. In these cases, the developer should mark those `Required: true` underlying attributes as `Optional: true` and `Computed: true`, but then they need introduce validation similar to `Required: true` which is not provided out of the by the framework or this Go module. That attribute flag just checks that the configuration value is not null if the attribute's containing object is present.
### Proposal
Introduce `NotNull`/`Required` validators into the following packages of this Go module:
* `boolvalidator`
* `float64validator`
* `int64validator`
* `listvalidator`
* `mapvalidator`
* `numbervalidator`
* `objectvalidator`
* `setvalidator`
* `stringvalidator`
After this is potentially merged and released, the framework implementation error can be introduced and the framework documentation needs to be updated to highlight the necessary schema changes and these validators for that situation.
### Additional Information
Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/898
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.