Prerequisites
Install the Pulumi and ESC cliCreating a stack and environment
The naming convention for a stack and environment isunkey/<project>/<aws_account_name>-<aws_region_shorthand>.
This document uses the api project as an example. Note that there exists a global environment for each AWS account to hold configuration items that don’t change across regions. Right now this is only the DSN for connecting to Planetscale. We can override these at the region level but we don’t need that quite yet.
Setting secrets
To set a secret nameddatabasePrimaryDsn for the unkey/api/canary-global environment, you would execute:
Configure the stack to use a secret
In theprojects/api directory, there exists a number of Pulumi.*.yaml files that reference the stack name, which is just the <aws_account_name>-<aws_region_shorthand> between the ..
For example in Pulumi.aws-canary-us-east-1.yaml we have:
api/canary-global environment, and sets the stacks environment to api/aws-canary-us-east-1. See Importing other environments for more information.
In the go code, you reference the secret by first creating a config object and then assigning the config value name to a variable like so
Inspecting config/secret values
At the global level you can see we have only thedatabasePrimaryDsn defined…
aws-canary-us-east-1 stack, you see the merged config of the global environment into

