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

resource/aws_lambda_function: Support waiting for State on CreateFunction and LastUpdatedStatus on UpdateFunctionConfiguration #11016

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 26, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

* resource/aws_lambda_function: Support waiting for function creation and configuration updates

Output from acceptance testing:

--- PASS: TestAccAWSLambdaFunction_basic (70.19s)
--- PASS: TestAccAWSLambdaFunction_concurrency (211.45s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (534.73s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (521.90s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (523.26s)
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (123.36s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (532.25s)
--- PASS: TestAccAWSLambdaFunction_envVariables (577.05s)
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (22.88s)
--- PASS: TestAccAWSLambdaFunction_KmsKeyArn_NoEnvironmentVariables (524.97s)
--- PASS: TestAccAWSLambdaFunction_Layers (389.18s)
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (162.39s)
--- PASS: TestAccAWSLambdaFunction_localUpdate (579.02s)
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (467.24s)
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (46.34s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java11 (109.79s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java8 (89.46s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs10x (417.73s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs12x (501.40s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs810 (503.90s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_noRuntime (1.18s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_provided (76.07s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python27 (57.04s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python36 (63.71s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python37 (101.66s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python38 (82.66s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_ruby25 (96.18s)
--- PASS: TestAccAWSLambdaFunction_s3 (48.57s)
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (70.87s)
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (71.77s)
--- PASS: TestAccAWSLambdaFunction_tags (153.01s)
--- PASS: TestAccAWSLambdaFunction_tracingConfig (521.15s)
--- PASS: TestAccAWSLambdaFunction_updateRuntime (525.56s)
--- PASS: TestAccAWSLambdaFunction_versioned (262.52s)
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (502.87s)
--- PASS: TestAccAWSLambdaFunction_VPC (1810.83s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (1667.42s)
--- PASS: TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies (1378.09s)
--- PASS: TestAccAWSLambdaFunction_VPCRemoval (3110.44s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (2027.87s)

…tion and LastUpdatedStatus on UpdateFunctionConfiguration

Output from acceptance testing in AWS Commercial (us-west-2):

```
--- PASS: TestAccAWSLambdaFunction_basic (369.24s)
--- PASS: TestAccAWSLambdaFunction_concurrency (250.87s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (470.65s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (515.49s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (509.55s)
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (167.42s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (323.02s)
--- PASS: TestAccAWSLambdaFunction_envVariables (140.79s)
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (21.51s)
--- PASS: TestAccAWSLambdaFunction_Layers (65.21s)
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (553.66s)
--- PASS: TestAccAWSLambdaFunction_localUpdate (270.54s)
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (241.10s)
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (165.93s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java8 (166.81s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs10x (173.61s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs810 (298.36s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_noRuntime (0.91s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_provided (272.34s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python27 (438.99s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python36 (480.28s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python37 (467.07s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_ruby25 (473.34s)
--- PASS: TestAccAWSLambdaFunction_s3 (42.83s)
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (61.96s)
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (64.14s)
--- PASS: TestAccAWSLambdaFunction_tags (406.96s)
--- PASS: TestAccAWSLambdaFunction_tracingConfig (458.91s)
--- PASS: TestAccAWSLambdaFunction_updateRuntime (549.47s)
--- PASS: TestAccAWSLambdaFunction_versioned (58.40s)
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (614.81s)
--- PASS: TestAccAWSLambdaFunction_VPC (1806.38s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (1627.71s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (1820.07s)
```

Output from acceptance testing in AWS Commercial (us-east-2):

```
--- PASS: TestAccAWSLambdaFunction_basic (38.55s)
--- PASS: TestAccAWSLambdaFunction_concurrency (42.00s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (47.59s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (48.46s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (56.49s)
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (29.17s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (59.43s)
--- PASS: TestAccAWSLambdaFunction_envVariables (68.92s)
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (12.06s)
--- PASS: TestAccAWSLambdaFunction_Layers (30.71s)
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (57.00s)
--- PASS: TestAccAWSLambdaFunction_localUpdate (37.25s)
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (35.00s)
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (10.17s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java8 (34.43s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs10x (33.29s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs810 (29.69s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_noRuntime (0.59s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_provided (27.31s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python27 (35.12s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python36 (26.88s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python37 (32.30s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_ruby25 (25.78s)
--- PASS: TestAccAWSLambdaFunction_s3 (29.69s)
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (35.45s)
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (35.65s)
--- PASS: TestAccAWSLambdaFunction_tags (39.01s)
--- PASS: TestAccAWSLambdaFunction_tracingConfig (47.01s)
--- PASS: TestAccAWSLambdaFunction_updateRuntime (41.10s)
--- PASS: TestAccAWSLambdaFunction_versioned (31.86s)
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (40.01s)
--- PASS: TestAccAWSLambdaFunction_VPC (1331.10s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (1356.30s)
--- PASS: TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies (1289.59s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (1455.46s)
```

Output from acceptance testing in AWS GovCloud (US) (us-gov-west-1):

```
--- PASS: TestAccAWSLambdaFunction_basic (96.45s)
--- PASS: TestAccAWSLambdaFunction_concurrency (128.26s)
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (153.75s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfig (127.93s)
--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (133.99s)
--- PASS: TestAccAWSLambdaFunction_EmptyVpcConfig (102.99s)
--- PASS: TestAccAWSLambdaFunction_encryptedEnvVariables (173.12s)
--- PASS: TestAccAWSLambdaFunction_envVariables (188.44s)
--- PASS: TestAccAWSLambdaFunction_expectFilenameAndS3Attributes (24.13s)
--- PASS: TestAccAWSLambdaFunction_Layers (116.48s)
--- PASS: TestAccAWSLambdaFunction_LayersUpdate (152.43s)
--- PASS: TestAccAWSLambdaFunction_localUpdate (155.31s)
--- PASS: TestAccAWSLambdaFunction_localUpdate_nameOnly (137.67s)
--- PASS: TestAccAWSLambdaFunction_nilDeadLetterConfig (66.45s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_java8 (49.98s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs10x (83.39s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_NodeJs810 (115.81s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_noRuntime (1.48s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_provided (89.89s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python27 (57.00s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python36 (44.05s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_python37 (63.82s)
--- PASS: TestAccAWSLambdaFunction_runtimeValidation_ruby25 (70.84s)
--- PASS: TestAccAWSLambdaFunction_s3 (41.56s)
--- PASS: TestAccAWSLambdaFunction_s3Update_basic (70.50s)
--- PASS: TestAccAWSLambdaFunction_s3Update_unversioned (66.96s)
--- PASS: TestAccAWSLambdaFunction_tags (115.43s)
--- PASS: TestAccAWSLambdaFunction_updateRuntime (130.79s)
--- PASS: TestAccAWSLambdaFunction_versioned (119.31s)
--- PASS: TestAccAWSLambdaFunction_versionedUpdate (169.21s)
--- PASS: TestAccAWSLambdaFunction_VPC (160.10s)
--- PASS: TestAccAWSLambdaFunction_VPC_withInvocation (165.84s)
--- PASS: TestAccAWSLambdaFunction_VpcConfig_ProperIamDependencies (153.32s)
--- PASS: TestAccAWSLambdaFunction_VPCRemoval (157.20s)
--- PASS: TestAccAWSLambdaFunction_VPCUpdate (177.42s)
```
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service. labels Nov 26, 2019
@bflad bflad added this to the v2.40.0 milestone Nov 26, 2019
@bflad bflad requested a review from a team November 26, 2019 03:34
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/M Managed by automation to categorize the size of a PR. labels Nov 26, 2019
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Nov 26, 2019
@bflad
Copy link
Contributor Author

bflad commented Nov 26, 2019

This pull request was previously reviewed and testing passes, merging. 👍

@bflad bflad merged commit f6df9ef into master Nov 26, 2019
@bflad bflad deleted the f-aws_lambda_function-state-handling branch November 26, 2019 03:49
bflad added a commit that referenced this pull request Nov 26, 2019
@ghost
Copy link

ghost commented Nov 27, 2019

This has been released in version 2.40.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ciaransweet
Copy link

@bflad I understand this has already been merged in, but I now get an error on previously working Lambda function creations:

Error: error waiting for Lambda Function (sentinel-find-images) creation: unexpected state '', wanted target 'Active'. last error: %!s(<nil>)

  on ../modules/lambda_functions/main.tf line 1, in resource "aws_lambda_function" "find-images":
   1: resource aws_lambda_function find-images {

This is being run against a LocalStack instance but I'm not sure that is the issue.

I've just pinned my aws provider to 2.39.0 and get:

module.lambda_functions.aws_lambda_function.find-images: Still creating... [10s elapsed]
module.lambda_functions.aws_lambda_function.find-images: Still creating... [20s elapsed]
module.lambda_functions.aws_lambda_function.find-images: Creation complete after 23s [id=sentinel-find-images]

@ewbankkit
Copy link
Contributor

ewbankkit commented Nov 27, 2019

From the AWS SDK v1.25.42 release notes:

Added the function state and update status to the output of GetFunctionConfiguration and other actions. Check the state information to ensure that a function is ready before you perform operations on it. Functions take time to become ready when you connect them to a VPC.

Blog post.
Developer guide.

@ghost
Copy link

ghost commented Mar 28, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants