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_event_invoke_config: Retry on additional IAM eventual consistency error with SNS Topic destinations #12171

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 26, 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

Release note for CHANGELOG:

* resource/aws_lambda_function_event_invoke_config: Retry on additional IAM eventual consistency error with SNS Topic destinations

Previous output from acceptance testing (starting January 8, 2020):

--- FAIL: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (39.34s)
    testing.go:654: Step 2 error: errors during apply:

        Error: error putting Lambda Function Event Invoke Config (tf-acc-test-2587868650326248481): InvalidParameterValueException: The function's execution role does not have permissions to call Publish on arn:aws:sns:us-west-2:*******:tf-acc-test-2587868650326248481

--- FAIL: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (38.93s)
    testing.go:654: Step 2 error: errors during apply:

        Error: error putting Lambda Function Event Invoke Config (tf-acc-test-3054348441165405395): InvalidParameterValueException: The function's execution role does not have permissions to call Publish on arn:aws:sns:us-west-2:*******:tf-acc-test-3054348441165405395

Output from acceptance testing:

--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_Latest (61.87s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionVersion (90.83s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunction (93.91s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunctionEventInvokeConfig (94.80s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_FunctionName_Arn (99.33s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Swap (101.83s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumEventAgeInSeconds (104.62s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_AliasName (106.73s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (107.43s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_basic (110.48s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumRetryAttempts (145.50s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Remove (146.86s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (151.83s)

… IAM eventual consistency error with SNS Topic destinations

Previous output from acceptance testing (starting January 8, 2020):

```
--- FAIL: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (39.34s)
    testing.go:654: Step 2 error: errors during apply:

        Error: error putting Lambda Function Event Invoke Config (tf-acc-test-2587868650326248481): InvalidParameterValueException: The function's execution role does not have permissions to call Publish on arn:aws:sns:us-west-2:*******:tf-acc-test-2587868650326248481

--- FAIL: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (38.93s)
    testing.go:654: Step 2 error: errors during apply:

        Error: error putting Lambda Function Event Invoke Config (tf-acc-test-3054348441165405395): InvalidParameterValueException: The function's execution role does not have permissions to call Publish on arn:aws:sns:us-west-2:*******:tf-acc-test-3054348441165405395
```

Output from acceptance testing:

```
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_Latest (61.87s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionVersion (90.83s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunction (93.91s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunctionEventInvokeConfig (94.80s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_FunctionName_Arn (99.33s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Swap (101.83s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumEventAgeInSeconds (104.62s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_AliasName (106.73s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (107.43s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_basic (110.48s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumRetryAttempts (145.50s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Remove (146.86s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (151.83s)
```
@bflad bflad added bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. labels Feb 26, 2020
@bflad bflad requested a review from a team February 26, 2020 02:12
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. labels Feb 26, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Mar 3, 2020
@gdavison
Copy link
Contributor

gdavison commented Mar 3, 2020

The contents of resourceAwsLambdaFunctionEventInvokeConfigCreate() and resourceAwsLambdaFunctionEventInvokeConfigUpdate() are mostly identical. Would it make sense to factor out the common parts?

Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

LGTM, other than the refactoring question 🚀

--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunction (27.97s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumEventAgeInSeconds (37.98s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunctionEventInvokeConfig (38.52s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionVersion (38.66s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_AliasName (39.38s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_basic (39.52s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_Latest (40.14s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_FunctionName_Arn (40.09s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (44.12s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Swap (48.07s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Remove (48.36s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumRetryAttempts (54.52s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (63.43s)

@bflad
Copy link
Contributor Author

bflad commented Mar 4, 2020

The contents of resourceAwsLambdaFunctionEventInvokeConfigCreate() and resourceAwsLambdaFunctionEventInvokeConfigUpdate() are mostly identical. Would it make sense to factor out the common parts?

Since Create and Update usually tend to differ on resources (e.g. different API call, SDK input types, ForceNew), we've historically preferred being verbose with no indirection for each resource function as the consistent implementation across all of them, but there are probably resources like this one with very similar shared logic. As long as the proposed logic does not introduce Go interfaces or complicated d.IsNewResource() logic, there probably is not too much reason to sway either which way other than making sure if there is a new standard it is documented/consistent itself so we don't recreate the XKCD. 😄

@bflad bflad added this to the v2.52.0 milestone Mar 4, 2020
@bflad bflad merged commit f34f5dd into master Mar 4, 2020
@bflad bflad deleted the t-aws_lambda_event_invoke_config branch March 4, 2020 03:10
bflad added a commit that referenced this pull request Mar 4, 2020
@ghost
Copy link

ghost commented Mar 6, 2020

This has been released in version 2.52.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 Apr 3, 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 Apr 3, 2020
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/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants