-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
New Data Source: aws_lambda_function #2984
Conversation
Not sure why acceptance test for resource lambda function fails sometime and retry will just pass.
|
807ef98
to
ea46dd8
Compare
|
@Puneeth-n thanks. good to know there is a fix. |
@loivis Nope. No fix. |
Plus one for this feature. I have recently needed to import lambda function qualified alias as a data source. |
Any idea when this would be merged into the master branch/released would be really useful? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in getting this reviewed. I have some concerns with resource changes breaking modules/outputs. Please let us know if you have any questions.
Otherwise, it looks to be in pretty decent shape.
@@ -161,6 +161,11 @@ func resourceAwsLambdaFunction() *schema.Resource { | |||
Optional: true, | |||
Computed: true, | |||
}, | |||
"source_code_size": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things:
- This does not look configurable -- we should remove
Optional: true
- Its not documented in the resource documentation
params := &lambda.GetFunctionInput{ | ||
FunctionName: aws.String(d.Get("function_name").(string)), | ||
} | ||
|
||
// qualifier for lambda function data source | ||
qualifier, qualifierExistance := d.GetOk("qualifier") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally speaking, if there starts being logic like this in a shared resource/data source read function, we will want to not reuse the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree but not sure in this case. It's a choice of duplicating the whole function or adding a few lines to current function. Maybe add qualifier
attribute to resource as well although it will always be $LATEST
for resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can always adjust this later if necessary as its probably fine the way it currently is. 👍
aws/resource_aws_lambda_function.go
Outdated
if vpcSetErr != nil { | ||
return fmt.Errorf("Failed setting vpc_config: %s", vpcSetErr) | ||
vpcConfig := flattenLambdaVpcConfigResponse(function.VpcConfig) | ||
if vpcConfig != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will likely break module/output usage. Why was this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really recall what I was thinking at that time 🤔
aws/resource_aws_lambda_function.go
Outdated
if err := d.Set("environment", flattenLambdaEnvironment(function.Environment)); err != nil { | ||
log.Printf("[ERR] Error setting environment for Lambda Function (%s): %s", d.Id(), err) | ||
environment := flattenLambdaEnvironment(function.Environment) | ||
if environment != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. This will likely break module/output usage. Why was this changed?
ea46dd8
to
88fec93
Compare
933d5ec
to
9146695
Compare
9146695
to
0c7db4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR adjustments, this looks great! 🚀
35 tests passed (all tests)
=== RUN TestAccAWSLambdaFunction_importS3
--- PASS: TestAccAWSLambdaFunction_importS3 (31.87s)
=== RUN TestAccAWSLambdaFunction_importLocalFile
--- PASS: TestAccAWSLambdaFunction_importLocalFile (90.78s)
=== RUN TestAccAWSLambdaFunction_importLocalFile_VPC
--- PASS: TestAccAWSLambdaFunction_importLocalFile_VPC (96.75s)
=== RUN TestAccAWSLambdaFunction_expectFilenameAndS3Attributes
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (118.00s)
=== RUN TestAccAWSLambdaFunction_nilDeadLetterConfig
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (123.49s)
=== RUN TestAccAWSLambdaFunction_s3
--- PASS: TestAccAWSLambdaFunction_s3 (20.84s)
=== RUN TestAccAWSLambdaFunction_VPC
--- PASS: TestAccAWSLambdaFunction_VPC (53.65s)
=== RUN TestAccDataSourceAWSLambdaFunction_environment
--- PASS: TestAccDataSourceAWSLambdaFunction_environment (145.22s)
=== RUN TestAccAWSLambdaFunction_concurrencyCycle
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (148.29s)
=== RUN TestAccDataSourceAWSLambdaFunction_vpc
--- PASS: TestAccDataSourceAWSLambdaFunction_vpc (183.58s)
=== RUN TestAccAWSLambdaFunction_runtimeValidation_noRuntime
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_noRuntime (0.88s)
=== RUN TestAccAWSLambdaFunction_updateRuntime
--- PASS: TestAccAWSLambdaFunction_updateRuntime (187.02s)
=== RUN TestAccAWSLambdaFunction_s3Update_unversioned
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (40.62s)
=== RUN TestAccAWSLambdaFunction_localUpdate
--- PASS: TestAccAWSLambdaFunction_localUpdate (44.85s)
=== RUN TestAccAWSLambdaFunction_envVariables
--- PASS: TestAccAWSLambdaFunction_envVariables (193.20s)
=== RUN TestAccAWSLambdaFunction_versioned
--- PASS: TestAccAWSLambdaFunction_versioned (241.47s)
=== RUN TestAccAWSLambdaFunction_DeadLetterConfigUpdated
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (256.48s)
=== RUN TestAccAWSLambdaFunction_runtimeValidation_python36
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python36 (74.15s)
=== RUN TestAccDataSourceAWSLambdaFunction_alias
--- PASS: TestAccDataSourceAWSLambdaFunction_alias (317.89s)
=== RUN TestAccAWSLambdaFunction_runtimeValidation_nodeJs43
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_nodeJs43 (136.04s)
=== RUN TestAccAWSLambdaFunction_runtimeValidation_java8
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java8 (138.79s)
=== RUN TestAccAWSLambdaFunction_concurrency
--- PASS: TestAccAWSLambdaFunction_concurrency (349.50s)
=== RUN TestAccDataSourceAWSLambdaFunction_version
--- PASS: TestAccDataSourceAWSLambdaFunction_version (349.82s)
=== RUN TestAccAWSLambdaFunction_VPCUpdate
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (259.20s)
=== RUN TestAccAWSLambdaFunction_versionedUpdate
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (391.44s)
=== RUN TestAccAWSLambdaFunction_localUpdate_nameOnly
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (250.17s)
=== RUN TestAccAWSLambdaFunction_tags
--- PASS: TestAccAWSLambdaFunction_tags (209.43s)
=== RUN TestAccAWSLambdaFunction_DeadLetterConfig
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (429.69s)
=== RUN TestAccAWSLambdaFunction_basic
--- PASS: TestAccAWSLambdaFunction_basic (443.10s)
=== RUN TestAccAWSLambdaFunction_runtimeValidation_python27
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python27 (259.04s)
=== RUN TestAccAWSLambdaFunction_encryptedEnvVariables
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (462.26s)
=== RUN TestAccDataSourceAWSLambdaFunction_basic
--- PASS: TestAccDataSourceAWSLambdaFunction_basic (469.13s)
=== RUN TestAccAWSLambdaFunction_s3Update_basic
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (431.48s)
=== RUN TestAccAWSLambdaFunction_VPC_withInvocation
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (493.76s)
=== RUN TestAccAWSLambdaFunction_tracingConfig
--- PASS: TestAccAWSLambdaFunction_tracingConfig (599.84s)
This has been released in version 1.16.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
To get information of lambda function.
Attributes are returned from read function of
aws_lambda_function
resource. Most of the attributes for resource are available for data source.tags
is one exception though because it doesn't exist ifqualifier
is specified.