https://pulumi.com logo
#typescript
Title
# typescript
s

salmon-account-74572

03/23/2020, 10:36 PM
I have a somewhat newbie-ish question. I'm trying to store stack-specific configuration details with
pulumi config set ...
and then access them in my TypeScript code. In the past, when only dealing with AWS-specific details, I'd use this code:
Copy code
const config = new pulumi.Config("aws");
const configRegion = config.require("region");
Now, though, I'm trying access both AWS-specific details and non-AWS specific information. I would've thought this would work, but it doesn't:
Copy code
const config = new pulumi.Config();
const configRegion = config.require("aws:region");
Instead, I keep getting prompted to set configuration value
<stack-name>:aws:region
. I've set the region using
pulumi config set aws:region us-west-2
and
pulumi config set <stack-name>:aws:region us-west-2
, both to no avail. (The latter option doesn't work, even though that's what
pulumi preview
references as an error.) What am I missing?
g

gentle-diamond-70147

03/23/2020, 11:13 PM
For AWS-specific values, you'll still need to use the
aws
context and for non-AWS use the "default". e.g.
Copy code
const awsConfig = new pulumi.Config("aws");
const configRegion = awsConfig.require("region");

const config = new pulumi.Config();
const otherValue = config.require("otherValue");
Note: we have an issue open to make this simpler - https://github.com/pulumi/pulumi/issues/3730.
s

salmon-account-74572

03/23/2020, 11:16 PM
Got it. That's how I solved it temporarily while awaiting a response; now I know my temporary fix is the permanent fix. Thank you!
👍 2