Skip to content

Re-run FunctionEnvironmentUpdate when Lambda changes#6920

Merged
vimtor merged 1 commit into
anomalyco:devfrom
achadha235:dev
Jun 24, 2026
Merged

Re-run FunctionEnvironmentUpdate when Lambda changes#6920
vimtor merged 1 commit into
anomalyco:devfrom
achadha235:dev

Conversation

@achadha235

Copy link
Copy Markdown
Contributor

Fixes #6919

Problem

When the Lambda's environment is updated through the main Function resource, FunctionEnvironmentUpdate does not re-run. Its inputs (environment, functionName, etc.) are unchanged, so Pulumi skips it — even though the underlying Lambda was just updated.

That means env vars added via addEnvironment() are not reconciled: they can be left stale on the function or out of sync with what the resource expects.

Solution

Pass function.lastModified into FunctionEnvironmentUpdate as a new functionLastModified input. AWS updates this timestamp whenever the Lambda changes, so Pulumi treats it as an input change and re-runs the custom resource's update.

Changes

  • Wire this.function.lastModified through Function.addEnvironment() in function.ts
  • Add functionLastModified to the TypeScript provider inputs
  • Add FunctionLastModified to the Go resource inputs struct

Testing

I reproduced the bug with this code and ensured it was fixed with this change

  • Deploy an app using fn.addEnvironment() (e.g. function with url: true)
  • Change the function handler/code and redeploy
  • Confirm lazily added env vars are still present on the Lambda after deploy

@vimtor vimtor merged commit d1e8ff1 into anomalyco:dev Jun 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

addEnvironment vars disappear on redeploy

2 participants