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

Fix aws_lambda_event_source_mapping function name flapping #5454

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

julienduchesne
Copy link
Contributor

Went with DiffSupressFunc finally. I thought it was a bit weird to deprecate an argument just to prevent some flapping. Also, there's already a function implemented to get the function name from a lambda ARN

Changes proposed in this pull request:

  • Add DiffSupressFunc to the function_name argument that tries to convert the old value from ARN to name as well as the new one. This prevents flapping from name to ARN.

Output from acceptance testing:

TESTARGS='-run=TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName'  make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -run=TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (431.70s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       431.717s

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Aug 5, 2018
// Using function name or ARN should not be shown as a diff.
// Try to convert the old and new values from ARN to function name
oldFunctionName, oldFunctionNameErr := getFunctionNameFromLambdaArn(old)
newFunctionName, newFunctionNameErr := getFunctionNameFromLambdaArn(old)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be getFunctionNameFromLambdaArn(new)?

@bflad bflad added bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. labels Aug 6, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Aug 6, 2018
@julienduchesne
Copy link
Contributor Author

Sorry about that... Reran the tests

TESTARGS='-run=TestAccAWSLambdaEventSourceMapping'  make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -run=TestAccAWSLambdaEventSourceMapping -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_basic
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (106.22s)
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (102.49s)
=== RUN   TestAccAWSLambdaEventSourceMapping_sqs_basic
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (96.87s)
=== RUN   TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (35.84s)
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_import
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_import (94.64s)
=== RUN   TestAccAWSLambdaEventSourceMapping_kinesis_disappears
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_disappears (93.77s)
=== RUN   TestAccAWSLambdaEventSourceMapping_sqsDisappears
--- PASS: TestAccAWSLambdaEventSourceMapping_sqsDisappears (116.51s)
=== RUN   TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (118.02s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       764.386s

@bflad bflad added this to the v1.34.0 milestone Aug 29, 2018
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.

LGTM, thanks @julienduchesne! 🚀

8 tests passed (all tests)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_withFunctionName (34.09s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_disappears (74.80s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_import (75.37s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_removeBatchSize (79.74s)
--- PASS: TestAccAWSLambdaEventSourceMapping_kinesis_basic (80.51s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqsDisappears (96.38s)
--- PASS: TestAccAWSLambdaEventSourceMapping_changesInEnabledAreDetected (97.36s)
--- PASS: TestAccAWSLambdaEventSourceMapping_sqs_basic (102.55s)

@bflad bflad merged commit c4038ff into hashicorp:master Aug 29, 2018
bflad added a commit that referenced this pull request Aug 29, 2018
@bflad
Copy link
Contributor

bflad commented Aug 30, 2018

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

@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/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants