sparse-intern-71089
06/05/2019, 11:21 AMrapid-eye-32575
06/05/2019, 12:00 PMnew Config('<project-name>').requireObject('addressSpaces')
. The only caveat is, that it has to be valid JSON for this to workgentle-diamond-70147
06/05/2019, 1:58 PMrapid-eye-32575
06/05/2019, 2:23 PMgetObject
/ requireObject
just uses JSON#parse
under the hood (https://github.com/pulumi/pulumi/blob/375b75be84a4073adf939d0e3001229e4f3f4679/sdk/nodejs/config.ts#L133). If I run pulumi config set addressSpaces '["xx.xx.xx.xx/ab","yy.yy.yy.yy/cd"]'
to set the config value and run pulumi up
with the following `index.ts`:
import * as pulumi from "@pulumi/pulumi";
(new pulumi.Config("test").getObject("addressSpaces") as string[]).forEach(
addr => {
console.log(`Address: ${addr}`);
}
);
it outputs as you would expect
test$ pulumi up
Previewing update (dev):
Type Name Plan Info
+ pulumi:pulumi:Stack test-dev create 2 messages
Diagnostics:
pulumi:pulumi:Stack (test-dev):
Address: xx.xx.xx.xx/ab
Address: yy.yy.yy.yy/cd
Resources:
+ 1 to create
rapid-eye-32575
06/05/2019, 2:26 PMtall-terabyte-36404
06/06/2019, 9:50 AM