Hi all, I am trying to create a lambda within a vp...
# general
f
Hi all, I am trying to create a lambda within a vpc but it seems like the vpc configuration is not applied. The lambda was already created once by pulumi and the only change I did was to add
Copy code
vpcConfig: {
      subnetIds: lambdaVpcConfig.apply(lvc => lvc.lambdaVpcPrivateSubnetIds),
      securityGroupIds: [
        lambdaVpcConfig.apply(lvc => lvc.lambdaSecurityGroupId),
      ],
    },
Which
lambdaVpcConfig
is an output from a stack ref. When I run
pulumi up
, the changes appear in the diff but when it actually applies, nothing changes in regards to the vpc of the lambda (it's still on no vpc). Any idea what might be wrong ?
l
No, but aside: there is no need to use
apply
in these circumstances. Pulumi makes properties of outputs available in these cases.
Copy code
vpcConfig: {
      subnetIds: lambdaVpcConfig.lambdaVpcPrivateSubnetIds,
      securityGroupIds: lambdaVpcConfig.lambdaSecurityGroupIds
    },
Also note that your code has securityGroupIds set as an array of one object, which is an array of security group ID outputs. I'm guessing you wanted it to be an array of security group ID outputs, not an array of arrays of security group IDs?
f
I didn't know pulumi could access
output
properties without
apply
. Let me give it a try. On another note, the
lambdaSecurityGroupIds
is actually just one id, I misspelled it and was too lazy to change it 😞 I guess i`ll do that now 😄 Gonna edit the example just in case someone else has a take on the problem
I managed to get it to run in the vpc. I don't know how, because I didn't really change the code. I just ran the pulumi up 3 times and the 3rd time it worked. Could it be some permissions related issue? 🤔
l
No, but AWS doesn't always do everything immediately. Maybe this was already in progress in AWS, and simply took that long?