forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add yaml stack readme example (pulumi#1235)
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Stack README | ||
|
||
Full markdown support! Substitute stack outputs dynamically so that links can depend on your infrastructure! Link to dashboards, logs, metrics, and more. | ||
|
||
1. Reference a string stack output: ${outputs.strVar} | ||
2. Reference an array stack output: ${outputs.arrVar[1]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: stack-readme-yaml | ||
runtime: yaml | ||
description: A minimal Pulumi YAML program demonstrating stack readme feature | ||
variables: | ||
readme: | ||
Fn::ReadFile: ./Pulumi.README.md | ||
outputs: | ||
strVar: foo | ||
arrVar: | ||
- fizz | ||
- buzz | ||
readme: ${readme} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Example Stack README In the Pulumi Service | ||
|
||
This example shows how to set up a [Stack Readme](https://www.pulumi.com/docs/intro/pulumi-service/projects-and-stacks/#stack-readme) in YAML. | ||
|
||
Stack READMEs in the [Pulumi Service](https://app.pulumi.com/) dynamically update based on Stack Outputs. Stack READMEs interpolate output variables on the stack (${outputs.instances[0].ARN}) so that each stack can construct links to dashboards, shell commands, and other pieces of documentation. All of this content stays up to date as you stand up new stacks, rename resources, and refactor your infrastructure. | ||
|
||
To set a stack readme, simply set Stack Output named `readme` to the value of your templated Stack Readme file. In this example, we've called the file `Pulumi.README.md` | ||
|
||
|
||
#### Example Project Structure | ||
`./index.ts` | ||
```yaml | ||
name: stack-readme-yaml | ||
runtime: yaml | ||
description: A minimal Pulumi YAML program demonstrating stack readme feature | ||
variables: | ||
readme: | ||
Fn::ReadFile: ./Pulumi.README.md | ||
outputs: | ||
strVar: foo | ||
arrVar: | ||
- fizz | ||
- buzz | ||
readme: ${readme} | ||
``` | ||
|
||
|
||
`./Pulumi.README.md` | ||
```markdown | ||
# Stack README | ||
|
||
Full markdown support! Substitute stack outputs dynamically so that links can depend on your infrastructure! Link to dashboards, logs, metrics, and more. | ||
|
||
1. Reference a string stack output: ${outputs.strVar} | ||
2. Reference an array stack output: ${outputs.arrVar[1]} | ||
``` | ||
|
||
|
||
#### How to view the rendered stack readme: | ||
Run `pulumi up`, then go to the console by running `pulumi console`. Then click the readme tab |