How can I log stack reference values (in TS)? I tr...
# general
a
How can I log stack reference values (in TS)? I tried using pulumi.log https://www.pulumi.com/docs/intro/concepts/logging/#logging, regular console.log statements, but nothing prints out the value. simplified code:
Copy code
const oidcProvider = new pulumi.StackReference(`org/project/${awsAccount}`);
const oidcProviderArn = oidcProvider.getOutput('arn');

console.log(oidcProviderArn)
b
firstly, I’d recommend using
requireOutput
to ensure there’s actually a value there then
pulumi.log
should work
a
i switched to
requireOutput
, the following log statement doesn't output anything
Copy code
pulumi.log.debug(`${oidcProviderArn}`)
Could it be that logging doesn't work on this type
pulumi.Output<any>
?
b
you need to resolve the output with an apply, but don’t think that should be necessaru for log.debu
you could just export the const
Copy code
export const oidcProviderArn = ....
a
thanks, the export trick worked