Hi! I’m creating a AWS lambda in Python and I want...
# aws
s
Hi! I’m creating a AWS lambda in Python and I want to associate it with a created VPC. I’m doing:
Copy code
lambda_handler = aws.lambda_.Function(
        "my-lambda",
        name="my-lambda",
        code=pulumi.FileArchive(lambda_zip_path),
        runtime="python3.9",
        handler="main.handler",
        role=iam_role_for_lambda.arn,
        opts=pulumi.ResourceOptions(depends_on=[log_group]),
        vpc_config=aws.lambda_.FunctionVpcConfigArgs(
            vpc_id=vpc.id,
            subnet_ids=[public_subnet_1.id, private_subnet_1.id],
            security_group_ids=[allow_tls.id],
        ),
)
...but I get
error: aws:lambda/function:Function resource 'my-lambda' has a problem: Value for unconfigurable attribute: Can't configure a value for "vpc_config.0.vpc_id": its value will be decided automatically based on the result of applying this configuration.. Examine values at 'Function.VpcConfig.VpcId'.
I’m not sure I understand the error. Does anybody know what it means?
I guess
vpc_id
is a read only attribute? It should be written in the doc no?
I just removed
vpc_id
. It’s most probably a read-only attribute.