Skip to content

Equals validator for boolean types #231

Closed
@jar-b

Description

@jar-b

Terraform CLI and Framework Versions

% terraform version
Terraform v1.9.5
on darwin_arm64
% cat go.mod | rg terraform-plugin-framework
        github.com/hashicorp/terraform-plugin-framework v1.11.0
        github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0
        github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1
        github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0
        github.com/hashicorp/terraform-plugin-framework-validators v0.13.0

Use Cases or Problem Statement

The AWS provider recently implemented a resource which included a boolean argument that should only ever be null or true. To enforce this condition, we added a custom BoolEquals validator that confirms a non-null boolean value exactly matches that which the validator is configured with (in our case true).

I'm not sure if this use case is a common enough to warrant moving up into this repository, but thought I'd offer up our implementation just in case.

Proposal

Add a new Equals validator to the boolvalidator package.

Additional Information

The AWS provider implemented a custom version of this in a recent pull request:
hashicorp/terraform-provider-aws#39180

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions