Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix lambda provision id parser #11679

Closed

Conversation

ericksoen
Copy link
Contributor

Overview

This PR primarily encompasses three modifications that are delineated by each of the commits included in the PR:

  1. Generate unique id for Lambda function name so that the tests can run in parallel
  2. Support all the permitted variations of the function_name parameter value per the PutProvisionedConcurrencyConfig API documentation and update test cases
  3. Use more explicit variable names, i.e., lambdaName instead of rName since the value is used as the function_name property for Lambda resource by the config generator

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

Relates #11152

Release note for CHANGELOG:

resource/aws_lambda_provisioned_concurrency_config: Allow `function_arn` and `partial_arn` as valid `function_name` parameter values

Output from acceptance testing:

 make testacc TEST=./aws TESTARGS='-run=TestAccAWSLambdaProvisionedConcurrencyConfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLambdaProvisionedConcurrencyConfig -timeout 120m
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction (245.96s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig (269.41s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName (397.47s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions (400.98s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName (518.61s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       529.681s

...

@ericksoen ericksoen requested a review from a team January 20, 2020 18:11
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/L Managed by automation to categorize the size of a PR. service/lambda Issues and PRs that pertain to the lambda service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jan 20, 2020
@ericksoen ericksoen force-pushed the fix-lambda-provision-id-parser branch from 7e7758f to fce9849 Compare February 25, 2020 05:01
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Feb 25, 2020
@ericksoen
Copy link
Contributor Author

ericksoen commented Feb 25, 2020

Force pushed a revision to the PR to reduce superfluous line changes due to variable renaming, parameter renaming etc. Revised test output is below:

$ TF_ACC=1 go test ./aws -v -count 1 -parallel 1 -run=TestAccAWSLambdaProvision
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExe
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExe
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisi
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisi
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunctio
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunctio
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       1616.31

Base automatically changed from master to main January 23, 2021 00:56
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:56
The PutProvisionedConcurrencyConfig API supports multiple different
parameter formats for the function name argument. The ParseId method
previously supported only the functionName format (ignoring the function
ARN and partial ARN formats). When the latter formats were used, the
parseId behavior failed to correctly read data due to an invalid
parameter format exception.
stateT file resource id (functionName:qualifier)
@ericksoen
Copy link
Contributor Author

Rebased this locally off main and fixed failing tests. Will push updates shortly.

@ericksoen ericksoen force-pushed the fix-lambda-provision-id-parser branch from fce9849 to 36a9c5f Compare April 17, 2021 23:05
@ericksoen
Copy link
Contributor Author

Updated test results for the new code changes (includes unpushed change to change rName := acctest.RandomWithPrefix("tf-acc-test") to rName := fmt.Sprintf("%s-%s", "tf-acc-test", acctest.RandString(10)) to allow all tests to run in parallel):

$ make testacc TESTARGS='-run=TestAccAWSLambdaProvisionedConcurrencyConfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLambdaProvisionedConcurrencyConfig -timeout 120m
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== RUN   TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== PAUSE TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction
=== CONT  TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaProvisionedConcurrencyConfig (263.82s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_disappears_LambdaFunction (303.05s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_ProvisionedConcurrentExecutions (464.43s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_Qualifier_AliasName (760.67s)
--- PASS: TestAccAWSLambdaProvisionedConcurrencyConfig_QualifierFunctionName (769.54s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       770.787s

@ericksoen ericksoen force-pushed the fix-lambda-provision-id-parser branch from 741175f to e07a3a8 Compare April 18, 2021 17:19
@breathingdust breathingdust added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 6, 2021
@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

@jar-b
Copy link
Member

jar-b commented Jun 14, 2023

Hi @ericksoen - thanks for your effort on this patch! We opted for a different approach in #31933, migrating to the preferred comma-separated ID value. Unfortunately this meant we couldn't use this contribution, but we appreciate the submission. Thanks again!

@github-actions
Copy link

This functionality has been released in v5.4.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
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. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants