<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0"><channel><title>Pulumi Blog: Abhinav Gupta</title><link>https://www.pulumi.com/blog/author/abhinav-gupta/</link><description>Pulumi blog posts: Abhinav Gupta.</description><language>en-us</language><pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate><item><title>Aligning Projects between Service and DIY Backend</title><link>https://www.pulumi.com/blog/project-scoped-stacks-in-self-managed-backend/</link><pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate><guid>https://www.pulumi.com/blog/project-scoped-stacks-in-self-managed-backend/</guid><description>
&lt;img src="https://www.pulumi.com/images/generated/blog/project-scoped-stacks-in-self-managed-backend/index.png" /&gt;
&lt;p&gt;At Pulumi, our goal is to offer the best Infrastructure as Code experience for all cloud developers.
From the very beginning, we&amp;rsquo;ve believed that the best IaC experience is made possible by combining a great open source SDK and CLI with a great backend management service.
This is why we built &lt;a href="https://www.pulumi.com/product/pulumi-service/"&gt;Pulumi Cloud&lt;/a&gt;, a rich management platform for your Infrastructure as Code, which includes a forever free option for individuals, a generous free tier for teams, and critical tools for enterprises to manage IaC at scale.&lt;/p&gt;
&lt;p&gt;Over the last few years, we&amp;rsquo;ve continued to expand the features of the Pulumi Service - with &lt;a href="https://www.pulumi.com/blog/pulumi-deployments/"&gt;Deployments&lt;/a&gt;, &lt;a href="https://www.pulumi.com/docs/pulumi-cloud/audit-logs/"&gt;Audit Logs&lt;/a&gt;, &lt;a href="https://www.pulumi.com/docs/pulumi-cloud/access-management/saml/"&gt;SAML SSO&lt;/a&gt; and &lt;a href="https://www.pulumi.com/docs/pulumi-cloud/access-management/scim/"&gt;SCIM&lt;/a&gt;, &lt;a href="https://www.pulumi.com/docs/pulumi-cloud/access-management/teams/"&gt;Teams&lt;/a&gt;, &lt;a href="https://www.pulumi.com/blog/stack-transfers/"&gt;Stack Transfers&lt;/a&gt;, &lt;a href="https://www.pulumi.com/blog/new-improved-pulumi-service-console/"&gt;Favorites&lt;/a&gt;, &lt;a href="https://www.pulumi.com/docs/pulumi-cloud/access-management/organization-access-tokens/"&gt;Organization&lt;/a&gt; and &lt;a href="https://www.pulumi.com/docs/pulumi-cloud/access-management/team-access-tokens/"&gt;Team Access Tokens&lt;/a&gt; and much more.&lt;/p&gt;
&lt;p&gt;While the majority of Pulumi users do choose to use the Pulumi Service, we also know that there are good reasons why some organizations would prefer to use Pulumi IaC alone without the Pulumi Service. And so we support and continue to invest in enabling a variety of additional &lt;a href="https://www.pulumi.com/docs/iac/concepts/state-and-backends/"&gt;backends&lt;/a&gt; that allow the Pulumi CLI to be used with state stored in the local filesystem or in cloud storage like S3, Azure Blob Storage, or Google Cloud Storage.&lt;/p&gt;
&lt;p&gt;Historically the Pulumi Service backend and the DIY backend have differed in their handling of &amp;ldquo;projects&amp;rdquo;. The Pulumi Service stores state for a Pulumi stack in a separate namespace per project. The DIY backends have historically stored all stacks in a single namespace across all projects. This inconsistency has been a common source of confusion for users getting started with Pulumi when using the file storage backends.&lt;/p&gt;
&lt;p&gt;Today, we are aligning how projects are managed across all backends, adding &lt;strong&gt;Project-Scoped Stacks&lt;/strong&gt; support to DIY backends.&lt;/p&gt;
&lt;h2 id="background"&gt;Background&lt;/h2&gt;
&lt;p&gt;This section goes over some of the background necessary
to understand project-scoping and why it&amp;rsquo;s important.
Feel free to skip ahead to the next section if you&amp;rsquo;re already familiar with this.&lt;/p&gt;
&lt;h3 id="projects-and-stacks"&gt;Projects and stacks&lt;/h3&gt;
&lt;p&gt;Pulumi &lt;a href="https://www.pulumi.com/docs/concepts/projects/"&gt;&lt;em&gt;projects&lt;/em&gt;&lt;/a&gt; are a unit of organization.
A project holds the code and configuration for your infrastructure,
and can be used to deploy multiple stacks.
A &lt;a href="https://www.pulumi.com/docs/concepts/stack/"&gt;&lt;em&gt;stack&lt;/em&gt;&lt;/a&gt; is a single,
isolated instance of your infrastructure.&lt;/p&gt;
&lt;p&gt;For example, you might have an &amp;ldquo;app&amp;rdquo; project for your application,
deploying to the &amp;ldquo;test&amp;rdquo; and &amp;ldquo;prod&amp;rdquo; stacks.&lt;/p&gt;
&lt;p&gt;&lt;img src="projects-and-stacks.png" alt="Depiction of projects and stacks where an app is connected to a test and prod environment"&gt;&lt;/p&gt;
&lt;h3 id="whats-a-state-backend"&gt;What&amp;rsquo;s a state backend?&lt;/h3&gt;
&lt;p&gt;Each stack tracks metadata about your infrastructure
so it can manage your cloud resources.
This metadata is called &lt;a href="https://www.pulumi.com/docs/iac/concepts/state-and-backends/"&gt;&lt;em&gt;state&lt;/em&gt;&lt;/a&gt;
and it is stored in a &lt;em&gt;backend&lt;/em&gt; of your choosing:
&lt;strong&gt;Service&lt;/strong&gt; or &lt;strong&gt;DIY&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Service&lt;/strong&gt; backend is hosted at &lt;a href="https://app.pulumi.com/signin"&gt;&lt;code&gt;app.pulumi.com&lt;/code&gt;&lt;/a&gt;
or &lt;a href="https://www.pulumi.com/product/self-hosted/"&gt;on your own server&lt;/a&gt;.
It provides the best combination of usability, safety, and security for most users.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;DIY&lt;/strong&gt; backend stores state in a JSON file,
deferring to you to manage persistence of this information.
You can store it in Amazon S3, Azure Blob Store, Google Cloud Storage,
a system such as Minio or Ceph with an API compatible with Amazon S3,
or on your local filesystem.
Using this backend trades reliability and convenience of the Service backend
for additional control over where the information is stored.&lt;/p&gt;
&lt;p&gt;&lt;img src="whats-a-backend.png" alt="Diagram showing how &amp;lsquo;pulumi up&amp;rsquo; stores state in either a Service Backend (app.pulumi.com or self-hosted) or a Self-Managed Backend (cloud storage or local folder)."&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re unsure of which backend to use,
see &lt;a href="https://www.pulumi.com/docs/iac/concepts/state-and-backends/#deciding-on-a-state-backend"&gt;Deciding On a State Backend&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="project-scoped-stacks"&gt;Project-scoped stacks&lt;/h3&gt;
&lt;p&gt;Depending on your needs, you can have several Pulumi projects.
For example, you might have a &amp;ldquo;net&amp;rdquo; project to set up an Amazon VPC,
a &amp;ldquo;k8s&amp;rdquo; project to set up a Kubernetes cluster deployed to it,
and an &amp;ldquo;app&amp;rdquo; project to build and deploy your application to the cluster.
Each of these projects will have their own stacks, e.g. &amp;ldquo;test&amp;rdquo; and &amp;ldquo;prod&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The Pulumi Service backend scopes stacks to the project they belong to,
so we can re-use the names &amp;ldquo;test&amp;rdquo; and &amp;ldquo;prod&amp;rdquo; across different projects.&lt;/p&gt;
&lt;p&gt;&lt;img src="service-project-scoped-stack.png" alt="Diagram of a Pulumi organization &amp;lsquo;myorg&amp;rsquo; with three projects (net, k8s, app), each containing &amp;rsquo;test&amp;rsquo; and &amp;lsquo;prod&amp;rsquo; stacks."&gt;&lt;/p&gt;
&lt;p&gt;This was not the case for the DIY backend,
where stack names were global across all projects.
To work around this, users resorted to qualifying stack names
in the form &lt;code&gt;&amp;lt;project&amp;gt;-&amp;lt;stack&amp;gt;&lt;/code&gt; when using the DIY backend.&lt;/p&gt;
&lt;p&gt;&lt;img src="self-managed-unscoped-stacks.png" alt="Diagram of a self-managed Pulumi backend with flat stack names like net-test, k8s-test, and app-prod stored in a shared folder."&gt;&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re pleased to announce that such workarounds are no longer necessary!&lt;/p&gt;
&lt;h2 id="project-scoped-stacks-in-diy-backends"&gt;Project-scoped stacks in DIY backends&lt;/h2&gt;
&lt;p&gt;With the latest release of Pulumi,
we&amp;rsquo;ve added support for project-scoped stacks to the DIY backend.
Stacks created in new or empty DIY backends will automatically
use the new project-scoped layout.&lt;/p&gt;
&lt;p&gt;With this change,
you can now use stack names like &amp;ldquo;test&amp;rdquo; and &amp;ldquo;prod&amp;rdquo; across your projects
without risk of conflict—the same way you do with the Service backend.&lt;/p&gt;
&lt;p&gt;&lt;img src="self-managed-project-scoped-stack.png" alt="Diagram of a self-managed Pulumi backend with project-scoped stacks—separate folders for net, k8s, and app, each containing test and prod stacks."&gt;&lt;/p&gt;
&lt;h3 id="upgrading-existing-backends"&gt;Upgrading existing backends&lt;/h3&gt;
&lt;p&gt;Only stacks created in new or empty DIY backends
will scope stacks to projects.
Existing backends will continue to operate as they do today.&lt;/p&gt;
&lt;p&gt;If you have an existing DIY backend that you&amp;rsquo;d like to upgrade
to use project-scoped stacks,
you can do so with the new &lt;code&gt;pulumi state upgrade&lt;/code&gt; command,
which upgrades all stacks in the backend to use the new project-scoped layout.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ pulumi state upgrade
This will upgrade the current backend to the latest supported version.
Older versions of Pulumi will not be able to read the new format.
Are you sure you want to proceed?
Please confirm that this is what you&amp;#39;d like to do by typing `yes`:
&lt;/code&gt;&lt;/pre&gt;&lt;div class="note note-info"&gt;
&lt;div class="icon-and-line"&gt;
&lt;svg xmlns="http://www.w3.org/2000/svg" class="ph-icon ph-icon--fill" fill="currentColor" aria-hidden="true" focusable="false"&gt;&lt;use href="https://www.pulumi.com/icons/sprite.70121449e0dde6f8c01ff68423fffaa0336ecc73c7bbc87506404126694ca58c.svg#p-info-fill"/&gt;&lt;/svg&gt;
&lt;div class="line"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="content"&gt;Once stacks in a DIY backend are upgraded,
older versions of the Pulumi CLI will be unable to access those stacks.
This change cannot be reverted.&lt;/div&gt;
&lt;/div&gt;
&lt;h4 id="cleaning-up-old-stack-names"&gt;Cleaning up old stack names&lt;/h4&gt;
&lt;p&gt;If you previously qualified stack names with the project name to avoid conflicts,
you can use the &lt;code&gt;pulumi stack rename&lt;/code&gt; command to clean up these names after the upgrade.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ pulumi stack rename --stack app-test test
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src="upgrade-and-rename.png" alt="Diagram showing migration from a flat Pulumi stack name (app-test) to a project-scoped layout (app/test) using &amp;lsquo;pulumi state upgrade&amp;rsquo; and &amp;lsquo;pulumi stack rename test&amp;rsquo;."&gt;&lt;/p&gt;
&lt;div class="rounded-lg bg-violet-50 p-6 my-8"&gt;
&lt;p class="heading-4 m-0 mb-3 flex items-center gap-1.5"&gt;Manage stacks across your projects&lt;/p&gt;
&lt;div class="body-base m-0 text-gray-950"&gt;Organize your infrastructure into projects and reuse stack names like &lt;code&gt;test&lt;/code&gt; and &lt;code&gt;prod&lt;/code&gt; across them. Store state in Pulumi Cloud or a self-managed backend, whichever fits your team.&lt;/div&gt;
&lt;a href="https://app.pulumi.com/signup" data-track="blog-body-cta" class="btn btn-primary mt-4"&gt;
Get started
&lt;svg xmlns="http://www.w3.org/2000/svg" class="ph-icon ph-icon--regular size-4" fill="currentColor" aria-hidden="true" focusable="false"&gt;&lt;use href="https://www.pulumi.com/icons/sprite.70121449e0dde6f8c01ff68423fffaa0336ecc73c7bbc87506404126694ca58c.svg#p-arrow-right-regular"/&gt;&lt;/svg&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;h2 id="referencing-stacks-in-the-cli"&gt;Referencing stacks in the CLI&lt;/h2&gt;
&lt;p&gt;Many commands in the Pulumi CLI expect a stack name to be specified.
These commands accept a fully-qualified stack name in the form:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;org&amp;gt;/&amp;lt;project&amp;gt;/&amp;lt;stack&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where, &lt;code&gt;&amp;lt;org&amp;gt;&lt;/code&gt; is the organization name,
&lt;code&gt;&amp;lt;project&amp;gt;&lt;/code&gt; the project name,
and &lt;code&gt;&amp;lt;stack&amp;gt;&lt;/code&gt; the stack name.&lt;/p&gt;
&lt;p&gt;They also accept one of the following shorthand forms
if we&amp;rsquo;re inside the project directory:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;org&amp;gt;/&amp;lt;stack&amp;gt;
&amp;lt;stack&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For instance, given a stack &amp;ldquo;prod&amp;rdquo; inside the &amp;ldquo;app&amp;rdquo; project,
the following are all valid ways to refer to it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;my-org/app/prod
my-org/prod // if inside the app directory
prod // if inside the app directory
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With the latest release of Pulumi, the above is true for both
the Service backend and the DIY backend.&lt;/p&gt;
&lt;h3 id="referencing-diy-project-scoped-stacks"&gt;Referencing DIY project-scoped stacks&lt;/h3&gt;
&lt;p&gt;All projects in a DIY backend
are placed under a virtual organization named &amp;ldquo;organization&amp;rdquo;.
This value is constant and cannot be changed.&lt;/p&gt;
&lt;p&gt;Repeating the above examples with a DIY backend,
we can use any of the following forms to refer to the same stack:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;organization/app/prod
organization/prod // if inside the app directory
prod // if inside the app directory
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="availability"&gt;Availability&lt;/h2&gt;
&lt;p&gt;Support for project-scoped stacks in DIY backends is now available in Pulumi v3.61.0.
Give it a try and share your thoughts with us on the &lt;a href="https://slack.pulumi.com/"&gt;Pulumi Community Slack&lt;/a&gt;!&lt;/p&gt;</description><author>Justin Van Patten</author><author>Abhinav Gupta</author><category>features</category><category>releases</category></item><item><title>Streamline access to stack outputs with OutputDetails</title><link>https://www.pulumi.com/blog/stack-reference-output-details/</link><pubDate>Fri, 24 Mar 2023 00:00:00 +0000</pubDate><guid>https://www.pulumi.com/blog/stack-reference-output-details/</guid><description>
&lt;img src="https://www.pulumi.com/images/generated/blog/stack-reference-output-details/index.png" /&gt;
&lt;p&gt;You can use the new &lt;code&gt;StackReference.getOutputDetails&lt;/code&gt; method
to get output values from other stacks directly—without calling &lt;code&gt;Output.apply&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="what-are-stack-references"&gt;What are Stack References?&lt;/h2&gt;
&lt;div class="note note-info"&gt;
&lt;div class="icon-and-line"&gt;
&lt;svg xmlns="http://www.w3.org/2000/svg" class="ph-icon ph-icon--fill" fill="currentColor" aria-hidden="true" focusable="false"&gt;&lt;use href="https://www.pulumi.com/icons/sprite.70121449e0dde6f8c01ff68423fffaa0336ecc73c7bbc87506404126694ca58c.svg#p-info-fill"/&gt;&lt;/svg&gt;
&lt;div class="line"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="content"&gt;If you already understand stack references, skip on to &lt;a href="#introducing-outputdetails"&gt;Introducing &lt;code&gt;OutputDetails&lt;/code&gt;&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Stack references are a useful feature of Pulumi
that you can use to access output values from one stack in another.&lt;/p&gt;
&lt;p&gt;For instance,
let&amp;rsquo;s say you have a &amp;rsquo;network&amp;rsquo; stack that provisions an AWS VPC,
and an &amp;lsquo;app&amp;rsquo; stack that deploys your application on an EC2 instance in that VPC.
The app stack can reference the output of the network stack
to obtain the VPC ID, which it needs to configure the EC2 instance.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;pulumi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StackReference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;acmecorp/network/other&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;vpcId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOutput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;vpcId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;getOutput&lt;/code&gt; method above returns an &lt;code&gt;Output&lt;/code&gt; value that holds the result.
You can call &lt;code&gt;Output.apply&lt;/code&gt; to perform transformations on the output value.
As an example,
if you need to extract a subnet ID from a JSON string in the output,
you can use the following code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;subnetConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOutput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;subnetConfig&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;subnetId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;subnetConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;subnetId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This approach works but is limited because
the output value obtained from the &lt;code&gt;apply&lt;/code&gt; transformation
is also an &lt;code&gt;Output&lt;/code&gt; value.
You cannot access or manipulate this value directly,
and you must continue to use &lt;code&gt;apply&lt;/code&gt; repeatedly to consume the value.&lt;/p&gt;
&lt;p&gt;As an aid in resolving this problem, we have introduced &lt;code&gt;OutputDetails&lt;/code&gt;.
These provide direct access to the output of one stack from another stack.&lt;/p&gt;
&lt;h2 id="introducing-outputdetails"&gt;Introducing &lt;code&gt;OutputDetails&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ve added a new method, &lt;code&gt;StackReference.getOutputDetails&lt;/code&gt;,
to allow direct access to output values from stack references.
This method can be used as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;vpcIdDetails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOutputDetails&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;vpcId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;vpcId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;vpcIdDetails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Unlike the &lt;code&gt;getOutput&lt;/code&gt; method,
the resulting value is a plain value, not an &lt;code&gt;Output&lt;/code&gt; value.
As a result, there is no need to call &lt;code&gt;apply&lt;/code&gt; repeatedly
to transform or consume the value.&lt;/p&gt;
&lt;p&gt;Revisiting the previous example of extracting a value from a JSON string,
&lt;code&gt;getOutputDetails&lt;/code&gt; can be used as shown below:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;subnetConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOutputDetails&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;subnetConfig&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;subnetId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;subnetConfig&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;subnetId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Using subnet ID &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;subnetId&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="what-about-secrets"&gt;What about secrets?&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;getOutputDetails&lt;/code&gt; can also be used to access [secret outputs
generated by the referenced stack.
For example, if the referenced stack sets up a database
and produces the password as a stack output,
you can access it as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;passwordDetails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;dbStack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOutputDetails&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;databasePassword&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;passwordDetails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;secretValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="can-we-do-this-for-all-output-values"&gt;Can we do this for all &lt;code&gt;Output&lt;/code&gt; values?&lt;/h3&gt;
&lt;p&gt;Unfortunately, it is not feasible to do this to every &lt;code&gt;Output&lt;/code&gt; value.
Stack references are unique in that
the referenced stack must already have deployed
for the reference to be resolved.
Therefore, when the stack reference is created,
the outputs of the referenced stack are available immediately.
This is not the case for other &lt;code&gt;Output&lt;/code&gt; values.
Their values only become available as &lt;code&gt;pulumi update&lt;/code&gt; runs,
so we cannot access them in the same way.&lt;/p&gt;
&lt;h2 id="availability"&gt;Availability&lt;/h2&gt;
&lt;p&gt;This feature is available in all stable SDKs for Pulumi, starting from v3.55.0. &lt;a href="https://www.pulumi.com/docs/iac/get-started/"&gt;Give it a spin&lt;/a&gt; and share your thoughts with us on &lt;a href="https://slack.pulumi.com/"&gt;Slack&lt;/a&gt;!&lt;/p&gt;</description><author>Abhinav Gupta</author><category>features</category><category>stack-references</category></item></channel></rss>