https://pulumi.com logo
#python
Title
# python
f

fresh-actor-58531

11/17/2021, 6:50 AM
to differentiate the functionality on environment values
p

prehistoric-activity-61023

11/17/2021, 8:28 AM
if you want to read env variable, simply call
os.environ.get("AWS_PROFILE")
howerver, I think it’d be better to rely on different pulumi stacks to differentiate that
f

fresh-actor-58531

11/17/2021, 10:01 AM
👍
name = os.environ.get("AWS_PROFILE") print("env===", name) But i am getting value None
awsprofile dev, i added in config
in pulumi stack
m

millions-furniture-75402

11/17/2021, 1:36 PM
In TypeScript, it would look something like:
Copy code
const awsConfig = new pulumi.Config("aws");
const profile = awsConfig.require("profile");
so... untested Python:
Copy code
aws_config = pulumi.Config("aws")
profile = aws_config.require("profile")
p

prehistoric-activity-61023

11/17/2021, 2:53 PM
if you declare this in stack yaml file, snippet written by @millions-furniture-75402 is gonna work
3 Views