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

r/aws_lambda_event_source_mapping: Fix creation wait for proper state update #14765

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

shuheiktgw
Copy link
Collaborator

@shuheiktgw shuheiktgw commented Aug 20, 2020

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #14748

Release note for CHANGELOG:

r/aws_lambda_event_source_mapping: Fix creation wait for proper state update

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSLambdaEventSourceMappin'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLambdaEventSourceMappin -timeout 120m
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_basic
=== PAUSE TestAccAWSLambdaEventSourceMapping_kinesis_basic
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize
=== PAUSE TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize
=== RUN   TestAccAWSLambdaEventSourceMapping_sqs_basic
=== PAUSE TestAccAWSLambdaEventSourceMapping_sqs_basic
=== RUN   TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName
=== PAUSE TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_disappears
=== PAUSE TestAccAWSLambdaEventSourceMapping_kinesis_disappears
=== RUN   TestAccAWSLambdaEventSourceMapping_sqsDisappears
=== PAUSE TestAccAWSLambdaEventSourceMapping_sqsDisappears
=== RUN   TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected
=== PAUSE TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected
=== RUN   TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp
=== PAUSE TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp
=== RUN   TestAccAWSLambdaEventSourceMapping_BatchWindow
=== PAUSE TestAccAWSLambdaEventSourceMapping_BatchWindow
=== RUN   TestAccAWSLambdaEventSourceMapping_ParallelizationFactor
=== PAUSE TestAccAWSLambdaEventSourceMapping_ParallelizationFactor
=== RUN   TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts
=== PAUSE TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts
=== RUN   TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero
=== PAUSE TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero
=== RUN   TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds
=== PAUSE TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds
=== RUN   TestAccAWSLambdaEventSourceMapping_BisectBatch
=== PAUSE TestAccAWSLambdaEventSourceMapping_BisectBatch
=== RUN   TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig
=== PAUSE TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig
=== CONT  TestAccAWSLambdaEventSourceMapping_kinesis_basic
=== CONT  TestAccAWSLambdaEventSourceMapping_ParallelizationFactor
=== CONT  TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize
=== CONT  TestAccAWSLambdaEventSourceMapping_BatchWindow
=== CONT  TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig
=== CONT  TestAccAWSLambdaEventSourceMapping_BisectBatch
=== CONT  TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds
=== CONT  TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero
=== CONT  TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts
=== CONT  TestAccAWSLambdaEventSourceMapping_kinesis_disappears
=== CONT  TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp
=== CONT  TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected
=== CONT  TestAccAWSLambdaEventSourceMapping_sqsDisappears
=== CONT  TestAccAWSLambdaEventSourceMapping_sqs_basic
=== CONT  TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName
    TestAccAWSLambdaEventSourceMapping_sqsDisappears: resource_aws_lambda_event_source_mapping_test.go:251: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSLambdaEventSourceMapping_sqsDisappears (127.54s)
    TestAccAWSLambdaEventSourceMapping_kinesis_disappears: resource_aws_lambda_event_source_mapping_test.go:223: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts (139.52s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig (148.53s)
    TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected: resource_aws_lambda_event_source_mapping_test.go:279: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_disappears (155.69s)
--- PASS: TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp (156.36s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (160.62s)
2020/08/21 07:56:32 [DEBUG] Fetching Lambda Function: tf-acc-test-4577511994423204387
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (164.58s)
--- PASS: TestAccAWSLambdaEventSourceMapping_ParallelizationFactor (168.98s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds (189.27s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (207.27s)
--- PASS: TestAccAWSLambdaEventSourceMapping_BisectBatch (210.88s)
--- PASS: TestAccAWSLambdaEventSourceMapping_BatchWindow (215.29s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (222.94s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero (260.15s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (286.60s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	288.346s
...

Thank you for your review! 👍

@shuheiktgw shuheiktgw requested a review from a team August 20, 2020 23:05
@ghost ghost added size/S Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/lambda Issues and PRs that pertain to the lambda service. labels Aug 20, 2020
@shuheiktgw shuheiktgw changed the title r/aws_lambda_event_source_mapping: Fix creation wait for proper state… r/aws_lambda_event_source_mapping: Fix creation wait for proper state update Aug 20, 2020
Base automatically changed from master to main January 23, 2021 00:58
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:58
@bflad bflad self-assigned this Feb 11, 2021
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 11, 2021
bflad pushed a commit that referenced this pull request Feb 11, 2021
Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (55.29s)
--- FAIL: TestAccAWSLambdaEventSourceMapping_sqs_basic (64.70s) # #14765
--- PASS: TestAccAWSLambdaEventSourceMapping_SQSBatchWindow (77.70s)
--- PASS: TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp (83.78s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds (106.53s)
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (107.34s)
--- PASS: TestAccAWSLambdaEventSourceMapping_BisectBatch (107.85s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig (108.87s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (109.37s)
--- PASS: TestAccAWSLambdaEventSourceMapping_disappears (112.05s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisBatchWindow (115.26s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts (116.99s)
--- PASS: TestAccAWSLambdaEventSourceMapping_ParallelizationFactor (117.33s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (118.04s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero (120.57s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MSK (1684.38s)
```
@bflad
Copy link
Contributor

bflad commented Feb 11, 2021

This looks really good, thank you, @shuheiktgw 👍 Rebasing this to remove merge conflicts and adjusting waiters to match the very fresh Retries and Waiters documentation.

d.Set("enabled", false)
default:
log.Printf("[DEBUG] Lambda event source mapping is neither enabled nor disabled but %s", *eventSourceMappingConfiguration.State)
return fmt.Errorf("state is neither enabled nor disabled but %s", *eventSourceMappingConfiguration.State)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to prevent unexpected issues for now, likely going to keep this as a warning log.

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again, @shuheiktgw 🚀

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSLambdaEventSourceMapping_BisectBatch (84.88s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisBatchWindow (91.98s)
--- PASS: TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp (93.96s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts (99.00s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds (119.52s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (122.45s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero (123.92s)
--- PASS: TestAccAWSLambdaEventSourceMapping_disappears (140.88s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (148.30s)
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (150.96s)
--- PASS: TestAccAWSLambdaEventSourceMapping_SQSBatchWindow (151.81s)
--- PASS: TestAccAWSLambdaEventSourceMapping_ParallelizationFactor (154.00s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (179.49s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (194.97s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig (203.61s)

Output from acceptance testing in AWS GovCloud (US):

--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (51.56s)
--- PASS: TestAccAWSLambdaEventSourceMapping_SQSBatchWindow (79.77s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRecordAgeInSeconds (87.12s)
--- PASS: TestAccAWSLambdaEventSourceMapping_ParallelizationFactor (87.57s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisBatchWindow (108.33s)
--- PASS: TestAccAWSLambdaEventSourceMapping_BisectBatch (113.78s)
--- PASS: TestAccAWSLambdaEventSourceMapping_disappears (118.66s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (126.46s)
--- PASS: TestAccAWSLambdaEventSourceMapping_StartingPositionTimestamp (138.00s)
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (148.92s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttemptsZero (161.04s)
--- PASS: TestAccAWSLambdaEventSourceMapping_KinesisDestinationConfig (161.87s)
--- PASS: TestAccAWSLambdaEventSourceMapping_MaximumRetryAttempts (166.13s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (193.48s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (226.55s)

@bflad bflad merged commit d2233f4 into hashicorp:main Feb 11, 2021
@github-actions github-actions bot added this to the v3.28.0 milestone Feb 11, 2021
@ghost
Copy link

ghost commented Feb 12, 2021

This has been released in version 3.28.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!

@ghost
Copy link

ghost commented Mar 13, 2021

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 as resolved and limited conversation to collaborators Mar 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

r/aws_lambda_event_source_mapping: Creation doesn't wait for state to become 'Enabled' or 'Disabled'
2 participants