https://pulumi.com logo
r

ripe-russia-4239

06/27/2020, 9:35 PM
Hi 👋 I’m trying to write a simple test with Pulumi, TypeScript and AVA 🤓 At the moment, the app deliberately only creates a resource group in Azure while I get my tech stack up and running. My tests verify the tags on the resource group (similarly to the unit testing guide in the docs) and the Azure location in which the resource group is created. I’m struggling to test the
location
property of the created resource has the value I require, as I’ve set it in my
Pulumi.yaml
file and not in the
new azure.core.ResourceGroup()
call, as described in the docs. There are two things I can’t work out: • Is
Pulumi.yaml
an accepted place to store config common to all stacks in a project?
A closer reading of the docs suggest
Pulumi.<stack name>.yaml
only 🤔At what point are the config values used in creating the resource group? I’ve tried modifying my
newResource
fake as below, but the
location
property stubbornly remains
undefined
.
Copy code
newResource: (type, name, inputs) => {
  return {
    id: `${inputs.name}_id`,
    state: {
      ...inputs,
      name: inputs.name || name,
      location: inputs.location || config.get("azure:location"),
    },
  };
}

// ...

const config = new pulumi.Config();
Is the config, as loaded by Pulumi in the app, available in the test context, or these mock functions? Trying to use an exported config instance leaves me with leaked promises 😞
Is 
Pulumi.yaml
 an accepted place to store config common to all stacks in a project?
 A closer reading of the docs suggest 
Pulumi.<stack name>.yaml
 only 🤔
I've answered this question for myself, and confirmed that only
Pulumi.<stack name>.yaml
files are acceptable locations for configuration values.