Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement lambda function import #3376

Open
t0yv0 opened this issue Feb 2, 2024 · 0 comments
Open

Implement lambda function import #3376

t0yv0 opened this issue Feb 2, 2024 · 0 comments
Labels
area/import An issue related to `pulumi import` or the import resource option. kind/enhancement Improvements or new features size/M Estimated effort to complete (up to 5 days).

Comments

@t0yv0
Copy link
Member

t0yv0 commented Feb 2, 2024

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Currently lambda functions created with Pulumi assets or archives fail to import cleanly into Pulumi, specifically Pulumi does not recover the original source code or source package from the cloud and repackage it into the Pulumi program. Users that need to import lambda functions currently end up resorting to workarounds and it is not a good experience see for example the discussion below and in the associated PR:

#2392

  • only sourceCodeHash is imported
  • this runs amok newly upstream introduced ExactlyOnce validators since sourceCodeHash is expected alongside filename
  • the workaround suggested for Terraform of supplying a dummy filename combined with "ignoreChanges" does not work in Pulumi since ignoreChanges copies the empty state value before it hits TF validators
  • we currently workaround by patching upstream to weaken the validators

There's some indication that upstream is not fixing it in and has related issues:

Option 1: document how to actually import lambdas

We could at least work through what's the recommended way to import lambda functions in this provider is, and document it, possibly enhancing error messages to guide the user. It seems that recovering the source package should be possible from the console. Trying to see if there is a programmatic way as well? https://docs.aws.amazon.com/cli/latest/reference/lambda/#cli-aws-lambda does not seem to indicate it. If the code can be recovered, it can be turned into an S3 object and the function can then be specified in Pulumi using the indirect via Amazon S3 (using the s3_bucket, s3_key and s3_object_version arguments) method.

Option 2: build smooth automatic import

If recovering the source can be done programmatically, we can automate this all so that the import results in a new s3 object and a lambda code that references it using s3_key.

Affected area/feature

@t0yv0 t0yv0 added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team area/import An issue related to `pulumi import` or the import resource option. labels Feb 2, 2024
@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label Feb 5, 2024
@t0yv0 t0yv0 added the size/M Estimated effort to complete (up to 5 days). label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/import An issue related to `pulumi import` or the import resource option. kind/enhancement Improvements or new features size/M Estimated effort to complete (up to 5 days).
Projects
None yet
Development

No branches or pull requests

2 participants