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.");
}
future-barista-68134
06/23/2020, 9:45 PM
This results in a similar output to missing configuration values:
I don't use simple config values but config objects(-> Config.requireObject/requireSecretObject) and define validations using decorators(-> class-validator / class-transformer-validator ).
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.