This message was deleted.
# general
s
This message was deleted.
f
Best practice is to throw an exception. See example below:
Copy code
const numEc2 = config.requireNumber("numberOfEc2Instances");
if(numEc2 > 5) {
    throw new pulumi.RunError("Configuration variable 'numberOfEc2Instances' is larger than the allowed amount. Please set a value <= 5.");
}
This results in a similar output to missing configuration values:
👍 2
I’ve also added this for posterity: https://github.com/pulumi/pulumi/issues/4880
s
I don't use simple config values but config objects(-> Config.requireObject/requireSecretObject) and define validations using decorators(-> class-validator / class-transformer-validator ).
f
That’s a great pattern as well ☝️