Hi. I made some changes to the `vpcConfig` for lam...
# general
f
Hi. I made some changes to the
vpcConfig
for lambda callback functions, but pulumi doesn’t detect those changes when doing a
pulumi up
, is there something special that needs to be done to get pulumi to identify this configuration change?
b
did you make the changes in your code?
f
@billowy-army-68599 yes, I made the changes in code and want to deploy those changes, but it’s not getting picked up.
b
can you share the code?
f
@billowy-army-68599 sure:
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

const STACK = pulumi.getStack().trim();

const CIDR_BLOCK = "10.0.0.0/16";

// Construct a VPC
const vpc = new awsx.ec2.Vpc("main", {
  cidrBlock: CIDR_BLOCK,
  subnets: [
    { type: "public", name: "main-public" },
    { type: "private", name: "main-private" },
    { type: "isolated", name: "db" }
  ],
  tags: { env: STACK }
});

var securityGroupIds: pulumi.Input<pulumi.Input<string>[]> = [];

const defaultSecurityGroup = new aws.ec2.SecurityGroup("default", {
  vpcId: vpc.id,
  ingress: [],
  egress: [
    {
      protocol: "-1",
      fromPort: 0,
      toPort: 0,
      cidrBlocks: ["0.0.0.0/0"],
      ipv6CidrBlocks: ["::/0"]
    }
  ]
});

securityGroupIds.push(defaultSecurityGroup.id);

const testHandler = function getUsageHandler(
  vpc: awsx.ec2.Vpc,
  securityGroupIds: pulumi.Input<string>[]
) {
  return new aws.lambda.CallbackFunction(`test-${STACK}`, {
    tags: { env: STACK },
    runtime: "nodejs16.x",
    policies: [
      aws.iam.ManagedPolicy.LambdaFullAccess,
      aws.iam.ManagedPolicy.CloudWatchFullAccess,
      aws.iam.ManagedPolicy.CloudWatchEventsFullAccess,
      aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole
    ],
    vpcConfig: {
      subnetIds: vpc.privateSubnetIds,
      securityGroupIds: securityGroupIds
    },
    callbackFactory: () => {
      return async (request: awsx.apigateway.Request) => {
        console.log(request.body);
        return { statusCode: 202 };
      };
    }
  });
};

const test = testHandler(vpc, securityGroupIds);
export const testId = test.id;
Note
vpcConfig
. If I remove
vpcConfig
from the callback function configuration and run
pulumi up
it does not detect any changes.
b
this is likely an error with the mixin, can you file an issue here: https://github.com/pulumi/pulumi-aws/issues
f
Hi, while this issue is being address, is there a recommended work around?
@billowy-army-68599 bumping to see if you have any advice for how to move forward on this while this is still being looked into.
b
unfortunately serverless is not my area of expertise, I’ll see if I can get someone on the engineering team to look