2 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
The Stash resource in Pulumi allows users to save values directly to their stack's state, making it easier to persist information like deployment usernames or timestamps. It captures initial values that remain unchanged despite later updates, simplifying infrastructure management.
If you do, here's more
Pulumi has introduced the Stash resource, which allows users to save arbitrary values directly to their stack’s state. This is useful for capturing data that needs to persist beyond a single deployment, such as a unique identifier, the user who initially deployed the infrastructure, or a deployment timestamp. Previously, users had to rely on workarounds like external storage or custom resources to achieve this, making Stash a more efficient solution.
Creating a Stash is simple. For instance, you can capture the username of the person deploying the stack using Node.js. When the Stash is created, the input value reflects the current user, but the output will always return the original deployer’s name, even if the input changes in subsequent deployments. Stash can handle various data types, including strings, numbers, and objects, and respects secret annotations to ensure sensitive information remains encrypted.
Updating a Stash value requires a replacement. Users can trigger this through several methods, such as using the `--target-replace` option during deployment or marking the resource for replacement with the `pulumi state taint` command. There's also the `replacementTrigger` option that automates replacements when a specified condition changes, allowing for more dynamic management of stored values. The Stash resource is available in Pulumi version 3.208.0 and supports multiple programming languages including TypeScript, Python, and Go.
Questions about this article
No questions yet.