Hello! I am new to Pulumi and apologize if this mi...
# general
a
Hello! I am new to Pulumi and apologize if this might be a stupid question Just trying Pulumi out with aws and having trouble with getting nested configuration in the code So I have below in my stack yaml file
Copy code
autoscaling:environment:
  testEnv: testEnv
and I want to get it in typescript code
Copy code
let config = new pulumi.Config();
let test = config.get("environment.testEnv");

console.log(`Environment Variable: ${test}`);
When I run
pulumi up
I get
Environment Variable: undefined
rather than the environment variable
l
Is your project called "autoscaling"?
a
yes
l
So you could have
autoscaling:environment.testEnv: testEnv
What are you hoping to achieve?
a
so I am looking at nested configuration because I want to have a bunch of environment variables under that. so
Copy code
autoscaling:environment:
  testEnv: testEnv
  testEnv2: testEnv2
  testEnv3: testEnv3
I just don't know how to get the value of these in typescript code as in the above I have tried
config.get("environment.testEnv")
but It doesn't seems to be getting the value
l
That set-up creates an object called environment with three properties. Is that what you want?
Copy code
const environment = config.get("environment");
<http://pulumi.log.info|pulumi.log.info>(`${environmnet.testEnv} ${environment.testEnv2} ${environment.testEnv3}`);
Values are always of the form
<projectName>:<valueName>
, so you know that testEnv, testEnv2 etc. aren't values.
They're just properties on an object that is encoded in YAML.
a
ahh I see, thank you