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

Importing aws:lambda:/function:Function resource inputs failed to validate #2859

Closed
sandervb2 opened this issue Oct 6, 2023 · 2 comments
Closed
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@sandervb2
Copy link

What happened?

When I try to import an aws:lambda/function:Function resource I receive warnings that one of 'filename, image_uri or s3_bucket' values must be set for 'S3Bucket, imageUri or code'. The resource does import succesfully and gives me the output code for it but execution fails with the following errors:

error: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "s3_bucket": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.s3Bucket'.
error: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "image_uri": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.imageUri'.
error: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "filename": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.code'.

Example

This is the output when I import the Lambda Function resource:

pulumi import aws:lambda/function:Function <my_lambda_function> <my_lambda_function>
Previewing import (<stack_name>):
     Type                    Name                                                              Plan       Info
     pulumi:pulumi:Stack     aws-<stack_name>                                                 
 =   └─ aws:lambda:Function  <my_lambda_function>  import     4 warnings


Diagnostics:
  aws:lambda:Function (<my_lambda_function>):
    warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `aws` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
    warning: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "image_uri": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.imageUri'.
    warning: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "filename": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.code'.
    warning: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "s3_bucket": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.s3Bucket'.

Resources:
    = 1 to import
    695 unchanged

Do you want to perform this import? yes
Importing (<stack_name>):
     Type                    Name                                                              Status               Info
     pulumi:pulumi:Stack     aws-<stack_name>                                                           
 =   └─ aws:lambda:Function  <my_lambda_function>  imported (0.03s)     4 warnings


Diagnostics:
  aws:lambda:Function (<my_lambda_function>):
    warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `aws` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
    warning: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "image_uri": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.imageUri'.
    warning: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "s3_bucket": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.s3Bucket'.
    warning: aws:lambda/function:Function resource '<my_lambda_function>' has a problem: Invalid combination of arguments. "filename": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_lambda_function>.code'.

Resources:
    = 1 imported
    695 unchanged

Duration: 5s

And this is the output when I try to execute the code using a 'pulumi preview':

Previewing update (<stack_name>):
     Type                    Name                                                              Plan     Info
     pulumi:pulumi:Stack     aws-<stack_name>                                               
     └─ aws:lambda:Function  <my_function>           3 errors


Diagnostics:
  aws:lambda:Function (<my_function>):
    error: aws:lambda/function:Function resource '<my_function>' has a problem: Invalid combination of arguments. "s3_bucket": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_function>.s3Bucket'.
    error: aws:lambda/function:Function resource '<my_function>' has a problem: Invalid combination of arguments. "image_uri": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_function>.imageUri'.
    error: aws:lambda/function:Function resource '<my_function>' has a problem: Invalid combination of arguments. "filename": one of `filename,image_uri,s3_bucket` must be specified. Examine values at '<my_function>.code'.

Output of pulumi about

Backend        
Name           <backend_name>
URL            <backend_url>
User           <user_name>
Organizations  
Token type     personal

Dependencies:
NAME        VERSION
boto3       1.28.53
fabric      3.2.2
pip         22.3.1
psutil      5.9.5
pulumi-aws  6.4.0
requests    2.31.0
setuptools  65.5.1
wheel       0.38.4

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@sandervb2 sandervb2 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 6, 2023
@mikhailshilkov
Copy link
Member

@sandervb2 Thank you for reporting this issue and sorry for the trouble.

I suppose there is a problem somewhere in our Read implementation - either because we renamed the original property "filename" to "code", or because its type is Archive.

To unblock yourself, you probably need to specify the code property of your Function in the snippet that Pulumi generated.

@mikhailshilkov mikhailshilkov added resolution/duplicate This issue is a duplicate of another issue and removed needs-triage Needs attention from the triage team labels Oct 9, 2023
@mikhailshilkov
Copy link
Member

Actually, it looks like we are already tracking the same issue in #2392. I'll close this new issue as duplicate, let's track it in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants