https://pulumi.com logo
#aws
Title
# aws
d

delightful-monkey-90700

05/09/2022, 1:30 PM
I'm converting some AWS CDK code to Pulumi. One of the things I do is conditionally modify the environment variables for a Lambda, like so:
Copy code
node.addEnvironment('ENDPOINT_API', `https://${loadbalancerDomain}/api`);
What's the equivalent in Pulumi ? The
node
object is an instance of a Lambda Function
p

powerful-furniture-83753

05/10/2022, 12:44 PM
i do something like this too, i basically create a dictionary of my environment variables, and then pass them in to my lambda like this:
Copy code
environment: {
        variables: {
         SHARED_VAR_1: value1,
         SHARED_VAR_2: value2,
         ...lambdaSpecificDictionary,
        },
      },
d

delightful-monkey-90700

05/10/2022, 2:53 PM
The issue with that is that there's lots of logic that's grouped together, some of which depends on the Lambda Function object being instantiated -- so I would need to split the code within the conditional block up, which is inelegant because I'm repeating the condition
3 Views