```I want to access environment variables from my ...
# general
a
Copy code
I want to access environment variables from my config as follows:

const config = new pulumi.Config("environment");

const var1 = config.require("VAR_NAME");
const var2 = config.require("ANOTHER_VAR_NAME");


// This works

config:
  environment:VAR_NAME: "my value"
  environment:ANOTHER_VAR_NAME: "another value"

----------------------
// This does not work

config:
  environment:
    VAR_NAME: "my value"
    ANOTHER_VAR_NAME: "another value"
It feels redundant to list the
environment:
prefix on every line. Am I missing something obvious about YAML? Why doesn't this work?
w
a
I'm trying to get away from structured config because I've found that it's a mess when dealing with data structures containing both secret and non-secret values
w
Ah yeah, so if not using structured config, then the pattern is to prefix each config variable with the namespace. https://www.pulumi.com/docs/intro/concepts/config/#configuration-keys
a
Do you have any experience dealing with structured config where some values are secret and some arent?
w
Unfortunately, I have not dug into that use-case.