Skip to content

Wombatfreak6/terraform-provider-validatefx

 
 

Repository files navigation

🧩 Terraform Provider - ValidateFX

Go Version Build Status License Terraform Registry

Reusable validation functions for Terraform, built with the latest Terraform Plugin Framework.

ValidateFX lets you write cleaner, more expressive validations using functions like email, uuid, base64, and more. Use the assert function to validate conditions with custom error messages.


🚀 Example

terraform {
  required_providers {
    validatefx = {
      source  = "The-DevOps-Daily/validatefx"
      version = "0.1.0"
    }
  }
}

provider "validatefx" {}

variable "email" {
  type = string
}

locals {
  # Validate email with custom error message
  email_check = provider::validatefx::assert(
    provider::validatefx::email(var.email),
    "Invalid email address provided!"
  )

  # Or use in variable validation
  age_validation = provider::validatefx::assert(
    var.user_age >= 18,
    "User must be at least 18 years old!"
  )
}

⚙️ Development

git clone https://github.com/The-DevOps-Daily/terraform-provider-validatefx.git
cd terraform-provider-validatefx
go mod tidy
make build
make install
make dev

Example usage in examples/basic/main.tf.


🧩 Available Functions

Function Description
all_valid Return true when all provided validation checks evaluate to true.
any_valid Return true when any provided validation check evaluates to true.
assert Assert a condition with a custom error message.
base64 Validate that a string is Base64 encoded.
credit_card Validate that a string is a credit card number using the Luhn algorithm.
domain Validate that a string is a compliant domain name.
email Validate that a string is an RFC 5322 compliant email address.
ip Validate that a string is a valid IPv4 or IPv6 address.
json Validate that a string decodes to a JSON object.
matches_regex Validate that a string matches a provided regular expression.
phone Validate that a string is an E.164 compliant phone number.
semver Validate that a string follows Semantic Versioning (SemVer 2.0.0).
url Validate that a string is an HTTP(S) URL.
uuid Validate that a string is an RFC 4122 UUID (versions 1-5).
version Return the provider version string.

💡 Contributing

Open to PRs! Good first issues include adding new validators like is_hostname, cidr, or mac_address.


📜 License

MIT © 2025 DevOps Daily

About

Terraform provider to expose reusable validation functions

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 91.5%
  • HCL 5.1%
  • Makefile 2.1%
  • Dockerfile 1.3%