Open Eitol opened 3 months ago
Voting for Prioritization
Volunteering to Work on This Issue
Hey @Eitol 👋 Thank you for taking the time to raise this! In this case, the provider is behaving as I would expect it to. The package_type
argument has a default vault of Zip
(this is mentioned in the documentation). When using the Zip
package type, the API is reporting that handler and runtime must be set as well -- the error that's then returned by Terraform.
Explicitly setting the package_type
to Image
is what I would expect to be necessary here. That said, I believe this is something we could validate at the plan stage, which would be more of an enhancement request. Does that seem correct to you?
Hi, yes. I think that's correct. Ideally, since image_uri has been indicated, it is understood that an image is to be used. Therefore, indicating package_type=Image is redundant.
Terraform Core Version
1.8.4
AWS Provider Version
5.50.0
Affected Resource(s)
aws_lambda_function
Expected Behavior
Lambda function created
Actual Behavior
The function creation fails with the error: "handler and runtime must be set when PackageType is Zip"
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Create a resource aws_lambda_function with the field package_type empty. Get an error
Debug Output
No response
Panic Output
No response
Important Factoids
When the image_uri is set, the package_type must be explicitly set to 'Image' to avoid errors related to the handler and runtime settings.
References
https://github.com/hashicorp/terraform-provider-aws/issues/21864 https://github.com/hashicorp/terraform-provider-aws/pull/19514
https://stackoverflow.com/questions/76862775/what-is-this-terraform-error-trying-to-tell-me-about-image-configuration-blocks
Would you like to implement a fix?
Yes