abundant-airplane-93796
08/19/2020, 3:43 PMexport const gcpConfig = {
regions: config.requireObject<Array<string>>('gcp-regions'),
};
offending config value looks like
myconfig:gcp-regions:
- us-east1
Stack B - Infra:
Utilizes a custom resource that creates a GCP network and a bunch of subnets
const envConfig = new pulumi.StackReference('yadayada');
const gcpConfig = envConfig.getOutput('gcpConfig');
const regions = gcpConfig.apply((v) => v.regions);
Unfortunately I can't figure out any way to manipulate regions
back into an array of strings I can iterate over.
Can someone please help?gorgeous-egg-16927
08/19/2020, 3:52 PMconst gcpConfig = envConfig.getOutput("gcpConfig")
gcpConfig.apply((regions: string[]) => {
for (const region of regions) {
// Do stuff here
}
})
abundant-airplane-93796
08/19/2020, 4:07 PMstring[]
which obv. doesn't work, and pulumi.Input<string[]>
but that doesn't give me the ability to apply or iterate.
Does it make sense for my custom resource to accept a pulumi.Output
as an argument? feels wrong, but maybe I'm getting hung up on naminggorgeous-egg-16927
08/19/2020, 5:05 PMpulumi.Input<string[]>
, which can handle Outputs as well as raw values.
If you need to interact with that value in the custom resource logic, then you can do something like pulumi.output(myInputValue).apply(x => {...})
little-cartoon-10569
08/19/2020, 8:56 PMconst regions
) inside an .apply()
? That doesn't work, I think?