Skip to content

Consider Per-Type NotNull/Required Validators #185

Open
@bflad

Description

@bflad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions