hashicorp / terraform-provider-assert

Offers functions to validate and assert values within Terraform configurations, simplifying variable validation and custom conditions.
https://registry.terraform.io/providers/hashicorp/assert/latest/docs
Mozilla Public License 2.0
30 stars 6 forks source link

Introduce string functions empty, not_empty, blank & not_blank #55

Closed sdrzazga-nsd closed 2 days ago

sdrzazga-nsd commented 4 weeks ago

Hi.

Please consider to add the following string functions:

  1. empty - string == null || length(string) == 0
  2. not_empty - !empty(string)
  3. blank - string == null || IsWhitespaceOnly(string)
  4. not_blank - !blank(string)

Thank you.

bschaatsbergen commented 4 weeks ago

Hey @sdrzazga-nsd 👋 Thank you for taking the time to raise this! These seem like very useful functions to add to the assert provider. Allow me to get back to you soon.

bschaatsbergen commented 3 weeks ago

To break down the work proposed in this issue, it makes sense to start with empty and not_empty functions, as they would nicely complement the existing null and not_null functions for objects.

bschaatsbergen commented 2 weeks ago

Reopening this issue, because of the blank and not_blank functions that have not been discussed yet.

bschaatsbergen commented 2 weeks ago

We've released empty and not_empty as part of v0.13.0 of the Terraform Assert Provider.