Hello everyone! Thanks for the great product which...
# getting-started
s
Hello everyone! Thanks for the great product which Pulumi is. I have a question: in the Google Cloud Console I manually set an alert to send a notifcation to a slack channel when a service in the GKE restarts. Does anyone have experience doing that via Pulumi? Could you please point out to a tutorial or smth on how to do that?
Or is it smth you don’t normally do via Pulumi?
b
That isn't typically a pulumi thing - it doesn't monitor existing resources in that way. Essentially, you Declare your intention to create things, pulumi Creates them for you and stores the created state in a Stack. That Stack is what's referenced whenever you try to make a change, though you can try to force it to check the current actual state of the objects already in the Stack by running a Refresh command. Long story short - pulumi doesn't watch what it makes 🙂
s
In gcp alerts are implemented using Alert Policy objects, which looks like state…
p
You can declare AlertPolicies in Pulumi I believe, https://www.pulumi.com/docs/reference/pkg/gcp/monitoring/alertpolicy/
b
I think that shows how the relationship actually works.. pulumi is declarative - think of it like having your code explain exactly what you want to happen in on a layer of abstraction, that code is compared to a "ledger" (i.e. the stack / state) to enumerate the changes you actually need to apply. When it comes to monitoring things - there is no activity on the ledger. it's just a file written to a disk, and only checked whenever you or your code wants to compare something. And nothing will -ever- happen unless YOUR CODE would cause anything in the LEDGER to be changed. ONLY THEN would pulumi actually action anything against the resource (i.e. gcp). So you can run the same code 100 times and in principle it will be applied once and only once, the other 99 times it will just say "yes, what you are telling me to do has been done, I will not bother gcp about it". But! You CAN create policies /in/ gcp using gcp-native stuff, and manage those policies with pulumi 😉
s
Thanks everyone!