Did anyone encounter an issue with setting an outp...
# aws
e
Did anyone encounter an issue with setting an output of another stack as an input for current stack? I’m getting the following issue:
Copy code
aws:lambda/function:Function resource 'DEV-Lambda' has a problem: Computed attributes cannot be set: Computed attributes cannot be set, but a value was set for "vpc_config.0.vpc_id".. Examine values at 'Function.VpcConfig.VpcId'
l
No, it works fine for me. That doesn't look like is a stack output / input problem, it looks like you're assigning a value to a field that shouldn't have a value assigned (e.g. ARN).
e
@little-cartoon-10569 that’s weird… I’ve imported a few resources from my AWS account to
stackA
and trying to use them in
stackB
by using the
stackReference
feature. Why does it fail? The resources exists (as I imported them)
@little-cartoon-10569 I’m even trying to hardcode the values but I still get the same error message. How can it be 🤔
l
Yes, it isn't to do with the stack references (since the hardcoded values have the same problem).
Have you already finished importing the resource? It's now in your stack?
e
Super weird. Any tip what to check?
l
Is the import opt still set? You need to remove that after the import is complete.
(Not relevant if you imported using pulumi import)
Can you copy the code where you create the lambda?
The error message suggests that there's a
lambda.vpcConfig[0].vpcId
, which isn't correct. Is that in your code?
e
sending it
What I have is the following config on the lambda:
Copy code
vpcConfig = {
  vpcId: 'vpc-id-of-vpc',
  subnetIds: ['subnet-0x9173283495'],
  securityGroupIds: ['sg-jdfg93457345'],
};
Omitting the
vpcId
does not give me this error anymore
l
That looks ok...
e
I’ve checked that the ID is correct many many times. What could be the issue 😕
l
How are you assigning it to the lambda?
It looks like there's an array going into the json sent to the AWS API.. seems unlikely, but that's how I read the error message..
Looks like you're using weakly-typed javascript? Rather than TypeScript?
Maybe that's possible with javascript.. not sure.
e
I’m using typescript for this
passing it just as the docs suggests
Copy code
{
        /**
         * List of security group IDs associated with the Lambda function.
         */
        securityGroupIds: pulumi.Input<pulumi.Input<string>[]>;
        /**
         * List of subnet IDs associated with the Lambda function.
         */
        subnetIds: pulumi.Input<pulumi.Input<string>[]>;
        vpcId?: pulumi.Input<string>;
    }
l
You're not doing anything like
func.vpcConfig[0] = vpcConfig
? Because that's the only thing I can think of. If that's not it, then you'll need someone smarter than me...\
e
you’re smart enough! I’m not doing this kind of assignment 😕