Six Things You Might Not Know About the Pulumi Service
Posted on
As a reader of this blog, you’ve probably heard of the Pulumi Service, the default state-management backend of the Pulumi CLI. If that’s the case, there’s also a good chance you’ve heard of a number of the Service’s key features, like helping you organize your projects and stacks, collaborate with others with the help of organizations, or handle sensitive data securely with built-in support for encrypted secrets.
What you might not know, though, is that we’re adding new features to the Pulumi Service all the time, and that some of these features can be fairly easy to miss. So in this post, we’ll highlight a handful of the features you might not be aware of, and that we think make it even easier to manage your infrastructure with Pulumi.
Let’s get started!
Feature 1: Stack Tags
The first thing we’ll cover is the Pulumi stack tags feature. Stack tags are key/value pairs that are associated with your Pulumi stack. You can use them for any number of purposes, from keeping things organized to even flagging whether or not it’s okay for a script to reclaim the stack’s resources.
While you can create, edit, and remove stack tags using the Pulumi CLI (see pulumi stack tag
), you can also do so in the Pulumi Console:
Once set, you can quickly filter stacks on your organization’s Projects tab as well.
Feature 2: Link Updates to your CI/CD pipeline
Another helpful thing the Pulumi Service can do is link the Pulumi stack update to the CI/CD job or run that was used to perform it, as well as to the specific source commit:
When Pulumi updates a stack, it will store some information about the local machine state, such the current git SHA if the stack resides in a git
repository. It is with this data that the Pulumi Service links to relevant services where possible.
If you’re curious to know all of the information Pulumi has for a stack update, you can navigate to the Environment tab for that update:
Feature 3: Custom Update Messages
One of the most useful pieces of additional data stored with each update is the message
property. By default, Pulumi will use whatever the latest git
commit message is. But did you know you can customize that message from the command line?
By passing the --message
(or -m
) flag to pulumi up
, you can provide a custom update message, which can help explain the context for why you made a particular infrastructure change:
$ pulumi up --message "Release the hounds\!"
Feature 4: Viewing Resource Changes
Another thing you might have missed is that the Pulumi Service supports multiple views for a stack update’s logs.
The standard view mimics the Pulumi CLI’s output. However, you can switch to the Diff or Diagnostic views, too.
The Diff view displays all of the properties of modified resources, along with their previous/updated values. This can be helpful when trying to understand exactly what happened for a stack update.
The Diagnostic view just outputs so-called “diagnostic” messages from the Pulumi update. Most commonly, this is where you will see the output of things like calls to JavaScript’s console.log(...)
or Python’s print(...)
functions. It’ll also include the output of dependent tools, like the output when building Docker containers.
Feature 5: Stack Resource Visualization
Another cool feature of the Pulumi Service is being able to visualize a stack’s resources and their relationships to one another. This is a really important feature!
One of the advantages of using an infrastructure as code tool like Pulumi is that you aren’t just creating a flat list of resources. Instead, by the virtue of how the code and resource graph is structured, you are building a graph of resources.
This means that Pulumi has a semantic understanding of not only what resources are in your stack but also how they relate to one another.
If you navigate to a stack’s Resources tab, by default you see them listed in a table. You can filter this list by resource type, or by providing a custom filter:
However, in order to see the expanded resource graph, click the Graph View button. This will switch to rendering the resources as an interactive graph.
Notice here that the resources that are part of a component are grouped together. Also, you can double click on those nodes in the graph to expand or collapse them!
Feature 6: Drilling into Resource Properties
But you don’t need to just settle for a “top-level view” of your resources. You can click on any specific resource on the Resources tab, and see all of the properties of that resource.
This allows you to see all of the properties that Pulumi is tracking for that resource. It will also show you any relationships to other resources in the same stack.
The Pulumi Service also links you to the resource’s cloud provider’s console where possible, so you can see even more details.
There are plenty of other features to check out in the Pulumi Service, and we have exciting improvements on the way! As always, feel free to stop by the Pulumi Community Slack to learn more, ask questions, or share anything cool you’re up to!