aws-samples / service-catalog-engine-for-terraform-os

Apache License 2.0
135 stars 41 forks source link

Support for Terraform parameter Custom Validation Rules #60

Closed neelaruban closed 1 year ago

neelaruban commented 1 year ago

Currently Parameter parser for AWS Service Catalog Engine for Terraform only supports Terraform variable arguments including name, default, type, description and sensitive , but they do not support neither validation rules nor nullable fields .

I am proposing a solution where the parser supports validation rules and nullable values so even before it goes to the stage of terraform apply it should be able to return to the user the invalidity where the current ParserInvalidParameterException exception .

The proposal would help the bring about similar capability found in CFN templates to validate the parameter values with constraints from the CFN engine.

iampkmone commented 1 year ago

Hi @neelaruban,

Thank you for your proposal. We'll add this to our backlog of feature request.

neelaruban commented 1 year ago

@iampkmone thanks

dwiesttq commented 11 months ago

@neelaruban FWIW you can enter the value "null" (without quotes) when provisioning (which the engine interprets as a string), but Terraform will coerce the value to null for non-string datatypes. It's not a great workaround, but it works in some cases.

A quick look at the write_variable_override() function in override_manager.py would suggest that a check of the variable's datatype needs to be added in order to properly handle null versus "null".