Pulumi programs are authored in a general-purpose language like TypeScript, Python, Go, or C#. The full power of each language is available, including access to tools and libraries for that runtime. As it happens, that includes testing frameworks. For this activity, we’re going to talk specifically about unit tests, the bottom or foundation of the testing pyramid. In the future, we’ll add in integration tests and end-to-end tests, but we’re sticking with a simple demonstration of testing for now.
We’ve created some resources. Now, let’s see how we can use outputs outside of Pulumi. In this part, we’re going to explore more about stacks, stack outputs, and stack references. Stack outputs are, as you might guess, the values exported from any given stack. These values can also be obtained from the Pulumi Console, and they’re extremely useful when you want to run commands with the CLI that reference those values.
All resource input and output values are recorded as state and are stored in the Pulumi Service, a file, or a pluggable provider that you choose. These raw values are usually just server names, configuration settings, and so on. In some cases, however, these values contain sensitive data, such as database passwords or service tokens. The Pulumi Service always transmits and stores entire state files securely; however, Pulumi also supports encrypting specific values as “secrets” for extra protection.
We’ve created some resources. Now, let’s see how we can use outputs outside of Pulumi. In this part, we’re going to explore stack outputs. Stack outputs are, as you might guess, the values exported from any given stack. These values are shown during an update, can be retrieved with the Pulumi CLI, and are displayed in the Pulumi Console once you’ve exported them. Example values include resource IDs, computed IP addresses, and DNS names.
Every Pulumi program is deployed to a stack. A stack is an isolated, independently configurable instance of a Pulumi program. Stacks are commonly used to denote different phases of development (such as development, staging, and production) or feature branches (such as feature-x-dev). A project can have as many stacks as you need. By default, Pulumi creates a stack for you when you start a new project using the pulumi new command.
This tutorial digs a little deeper into what it means to create multiple Pulumi programs and work with them interdependently. We will also cover how Pulumi uses secrets and how you can test your Pulumi programs. Time How long this module will take depends on your internet connection, reading speed, and other factors. On average, this module should take you about 50 minutes to complete. Prerequisites You should have completed the Pulumi Fundamentals pathway already.