by gregmac · 3y ago · 0 comments
Think of it like if you used a GPPL to emit HCL. You get the power of that language: loops, function calls, unit tests, or even the ability to call external APIs. You're declaraing desired state and letting the framework sort it outb which is you say you aren't writing imperative code like:
if (!exists(dnszone)) create(dnszone);I want to write and review declarative, not compiles-to-declarative.
The engine doesn't compile to a declarative template. It's a common misconception, however because the user's program runs concurrently with the Pulumi engine, fully dynamic resource graphs are possible, including those inexpressible using templates.
This is Pulumi pseudocode:
const group = new ldap.DirectoryGroup("$saas-users);
// or any other runtime query:
for (const member of group.getMembers()) {
new saas.User(member.id, {
email: member.email,
name: member.fullName,
});
// could also do some other dynamic action, such as
// calling a webhook to complete user setup
And in ~10 lines of code you have a script or webhook you can use in situations where SCIM would normally be required.(n.b.: this is a simplified, illustrative example that the program drives the graph using its own using loops or other control flow.)