I have a somewhat newbie-ish question. I'm trying ...
# typescript
s
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
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
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