Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Per-Type NotNull/Required Validators #185

Open
1 task done
bflad opened this issue Jan 8, 2024 · 0 comments
Open
1 task done

Consider Per-Type NotNull/Required Validators #185

bflad opened this issue Jan 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@bflad
Copy link
Contributor

bflad commented Jan 8, 2024

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: hashicorp/terraform-plugin-framework#898

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant