https://pulumi.com logo
q

quiet-wolf-18467

09/13/2019, 1:21 PM
Config with
1.0
and
1.1
seems pretty broken due to change in the stack naming: https://github.com/pulumi/pulumi/issues/3223
b

best-xylophone-83824

09/13/2019, 1:23 PM
thanks for heads up
q

quiet-wolf-18467

09/13/2019, 1:24 PM
I guess there's no way for me to unblock myself atm?
b

best-xylophone-83824

09/13/2019, 1:26 PM
try editing stack config file directly
so instead of using
pulumi config set
, just edit yaml file
q

quiet-wolf-18467

09/13/2019, 1:27 PM
I already tried that, the config can't be unmarshalled
b

best-xylophone-83824

09/13/2019, 1:28 PM
how does error look like?
q

quiet-wolf-18467

09/13/2019, 1:28 PM
Copy code
╰ pulumi preview
error: getting secrets manager: could not unmarshal map: could not parse devrel-metrics:telegraf:version as a configuration key (configuration keys should be of the form `<namespace>:<name>`)
b

best-xylophone-83824

09/13/2019, 1:29 PM
are you sure there is no typo in
devrel-metrics
(letter 'r') ?
q

quiet-wolf-18467

09/13/2019, 1:29 PM
Positive
My team is developer relations
devrel
b

best-xylophone-83824

09/13/2019, 1:30 PM
ah, variable names probably can't have
:
, try
telegraf_version
q

quiet-wolf-18467

09/13/2019, 1:31 PM
So the namespace is the project name? Isn't that rather redundant
b

best-xylophone-83824

09/13/2019, 1:32 PM
there are other namespaces, each provider has one. I think it was the easiest option for them to go this route
q

quiet-wolf-18467

09/13/2019, 1:33 PM
but I can't specify my own namespace when using
require
or
requireSecret
?
b

best-xylophone-83824

09/13/2019, 1:40 PM
I think you can: new pulumi.Config("telegraf").require("version")
q

quiet-wolf-18467

09/13/2019, 2:04 PM
@best-xylophone-83824 Perhaps you can help me with one final thing, if you don't mind. When I use
const password = requireSecret('name');
I get an
Output
. This means I can't render a file to put in my
startupScript
. What is the expected way to handle this?
c

cool-egg-852

09/13/2019, 2:06 PM
If you do not specify a namespace when you do
pulumi.config()
it uses the project name. If you do specify it, then the variable has to have the namespace name like
namespace:key
To my knowledge this is how it has always worked
q

quiet-wolf-18467

09/13/2019, 2:06 PM
Thanks @cool-egg-852
any idea on the secret Output too? 🙂
c

cool-egg-852

09/13/2019, 2:08 PM
You need to either use
.apply
or
pulumi.interopolate
or a string template in some cases. It all depends on the situtation and also the style you want to go with.
b

best-xylophone-83824

09/13/2019, 2:08 PM
@quiet-wolf-18467
Copy code
const startupScript = password.apply(pw => `myScript with password=${pw}`);
q

quiet-wolf-18467

09/13/2019, 2:12 PM
I'm trying to use
handlebars
handlebars doesn't know how to deal with the pulumi object, as it has no
toHTML
method
I feel like I'm fighting an uphill battle with this one
c

cool-egg-852

09/13/2019, 2:14 PM
I’m sure it’s possible. You might want to post your code here so we can take a look and see.
c

cool-egg-852

09/13/2019, 2:23 PM
And what’s the part that isn’t working right?
q

quiet-wolf-18467

09/13/2019, 2:24 PM
Line 40
Copy code
Diagnostics:
  pulumi:pulumi:Stack (devrel-metrics-production):
    error: Running program '/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/src/index.ts' failed with an unhandled exception:
    TypeError: string.toHTML is not a function
        at escapeExpression (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/utils.js:68:21)
        at Object.eval (eval at createFunctionContext (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/
compiler/javascript-compiler.js:239:23), <anonymous>:12:7)
        at main (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/runtime.js:152:32)
        at Object.ret (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/runtime.js:155:12)
        at Object.ret [as output-influxcloud] (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/compiler
/compiler.js:513:21)
        at Object.invokePartialWrapper [as invokePartial] (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handleb
ars/runtime.js:51:46)
        at Object.eval (eval at createFunctionContext (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/
compiler/javascript-compiler.js:239:23), <anonymous>:8:28)
        at main (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/runtime.js:152:32)
        at ret (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/runtime.js:155:12)
        at ret (/home/rawkode/Code/src/github.com/influxdata/devrel-metric-collection/node_modules/handlebars/lib/handlebars/compiler/compiler.js:513:21)
handlebars is trying to use the
Output
object from Pulumi and can't render it to a string
b

best-xylophone-83824

09/13/2019, 2:27 PM
try
Copy code
const data = pulumi.output({
  telegrafVersion: config.require("telegraf_version"),
  influxCloudUrl: config.require("influxcloud_url"),
  influxCloudUsername: config.require("influxcloud_username"),
  influxCloudPassword: config.requireSecret("influxcloud_password"),
  influxCloudDatabase: config.require("influxcloud_database"),
  influxCloud2Url: config.require("influxcloud2_url"),
  influxCloud2Bucket: config.require("influxcloud2_bucket"),
  influxCloud2Organization: config.require("influxcloud2_organization"),
  influxCloud2Token: config.requireSecret("influxcloud2_token")
});

...

metadataStartupScript: data.apply( cfg => startupScriptCompiledTemplate(cfg)),
did it work?
q

quiet-wolf-18467

09/13/2019, 2:42 PM
Just walking my dog round the block. Let you know in 10 😀
@best-xylophone-83824 Looking good 🙂
Thank you so much for your help
c

creamy-potato-29402

09/13/2019, 6:21 PM
cc @microscopic-florist-22719?