Hello everyone! I’m trying to figure if I can use...
# aws
Hello everyone! I’m trying to figure if I can use some sort of dynamic configuration when defining a Cloudfront function. Basically I want the function body to use an array with some information that’s not hardcoded within the function. Is this something that’s possible?
If the value is known when Pulumi runs you can capture the values you want in the body of the function (at least in javascript/typescript). Or you can set the configuration as environment variables for the deployed function.
Apologies misread your question - Cloudfront Functions, not Lambda@Edge. For CF Functions pulumi requires the source code as a string and don't do capture of the function. You can create the code string dynamically using pulumi outputs. e.g.
Copy code
const code = pulumi.apply(output) => {
return `function handler(event) { console.log("${output}");
return event.request;