billions-hydrogen-34268
03/15/2023, 9:04 PMconst nonSecret = config.require("non-secret")
const nonSecretString = nonSecret.apply(v => `${v}`);
// or
const nonSecretString = pulumi.interpolate`${nonSecret}`;
These do not work because apiKey is an Output<T> and errors out when converting to a string:
const apiKey = config.requireSecret("myApiKey")
const apiKeyString = apiKey.apply(v => `${v}`);
// or
const apiKeyString = pulumi.interpolate`${apiKey}`;
Example of how I need to put the secret into a string:
const newObject = new gcp.pubsub.Subscription("new-sub", {
topic: existingPubSubTopic.name,
pushConfig: {
pushEndpoint: `<https://example.com/api/v2/logs?api-key=${apiKey}&protocol=gcp>`
},
project: config.require("gcp-project-id")
});
green-stone-37839
03/15/2023, 9:08 PMpulumi.interpolate
for this use case. https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#outputs-and-stringspushEndpoint: pulumi.interpolate `<https://example.com/api/v2/logs?api-key=${apiKey}&protocol=gcp>`
billions-hydrogen-34268
03/15/2023, 9:17 PMgreen-stone-37839
03/15/2023, 9:19 PMpushEndpoint
property itself accepts outputs. An output can never be a plain value (string, bool, etc) but using apply (or interpolate in this case) you can construct a new output that fits your purpose.