Open graza-io opened 7 months ago
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Context
When composing pipelines with variable inputs, sometimes we want to only support a limited number of options for the variable.
A simple example may be
var.route
which we may limit to wanting to be one of:As we use this variable to decide which child pipeline to initiate.
However, at the current time in order to achieve this, we have to run tests to cater for each potential value and then have another step that contains an
if
to check that the value isn't one we allow:This approach comes with a few issues:
Desired Solution
We do currently validate the
type
of the variable at parse time to ensure that astring
is astring
, etc. It would be beneficial if we could alsovalidate
the contents of the value against a "rule" at parse time also.This would reduce complexity around having to have the pipelines themselves handle/cater for invalid inputs as well as highlight these issues when loading the mod with vars/var-files.
Looking at HCL variables in Terraform, they have a clear and useful approach to variable validations: docs
Alternative Solution
We could implement a different approach to variable validation, but this would be custom and differentiate from the expectations of anyone who has used variable validation with Terraform may be expecting.