I’d love to learn more about how you do this. Do you have any helpful resources that I can look at to understand the process of creating a DSL with TS + Pulumi?
So instead of having 20 lines of code for every alert policy like at https://www.pulumi.com/registry/packages/gcp/api-docs/monito... you create a function that generates all the standardised alerts from concise strongly typed config such as
cloudSqlAlerts({
instanceId: 'sql-main',
highCpu: {
percent: 70,
duration: _5min
},
highMemory: {
percent: 80,
duration: _5min
},
highDisk: {
percent: 80,
duration: _10min
},
deadlockDetection: true
},
projectNotificationChannels)The ”DSL” is the typings, and the rest is nothing more than a simple TS program which calls JSON.stringify() with the type-checked config object and writes the resulting string to disk.