From 0f68a23f53f6a9bfecb64b786eb3d13f06ab9eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pra=C5=BCak?= Date: Fri, 29 Mar 2024 18:24:01 +0100 Subject: [PATCH] Add missing documentation on StackReference (#428) --- website/docs/basics.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/website/docs/basics.md b/website/docs/basics.md index 7b250fea..c0a9590a 100644 --- a/website/docs/basics.md +++ b/website/docs/basics.md @@ -141,13 +141,29 @@ To export values from a stack in Besom, use the [`Stack.exports`](exports.md) fu ##### Stack References -[Stack Reference](https://www.pulumi.com/docs/concepts/stack/#stackreferences) allows you to use outputs from other [stacks](#stacks) in your [program](#programs). +[Stack Reference](https://www.pulumi.com/docs/concepts/stack/#stackreferences) allows you to use [outputs](#stack-outputs) from +other [stacks](#stacks) in your [program](#programs). To reference values from another stack, create an instance of the `StackReference` type using the fully qualified name of the stack as an input, and then read exported stack outputs by their name. -`StackReference` is not implemented yet in Besom, coming soon. +Here's an example of how to use them: +```scala +@main def main = Pulumi.run { + // ... + Stack.exports( + someOutput = "Hello world!", + ) +} +``` +```scala +@main def main = Pulumi.run { + val otherStack = besom.StackReference("stackRef", StackReferenceArgs("organization/source-stack-test/my-stack-name")) + val otherStackOutput = otherStack.output[String]("someOutput") + // ... +} +``` ### Resources Resources are the primary [construct of Pulumi](https://www.pulumi.com/docs/concepts/resources/) programs.