Schema Validation Comes to Pulumi ESC with fn::validate
Blog post from Pulumi
Pulumi ESC environments now offer the ability to validate configuration values against JSON Schema using the new fn::validate built-in function, which ensures that any invalid configurations are immediately detected and cannot be saved until corrected. This proactive validation prevents misconfigurations from reaching deployment stages or, worse, being discovered in production. The function enables users to define validation rules within the environment, enforcing these rules at the time of saving. It works by comparing a given value against a defined JSON Schema, raising a validation error if there is a mismatch. The system also supports complex configurations by enforcing structures and required fields, and it facilitates the reuse of schemas across multiple environments, promoting consistent validation rules across teams and projects. If a value fails to conform to its schema, ESC provides a clear error message, preventing the environment from being saved until the issue is resolved. This feature is particularly useful for ensuring values meet specific type requirements, objects have necessary fields, numbers fall within valid ranges, and configurations shared across environments are consistently validated. The fn::validate function is readily available for use in all Pulumi ESC environments.