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

Set lambda function version to latest published version when no qualifier; set to "$LATEST" when no published version #11195

Merged
merged 10 commits into from
Sep 1, 2022

Conversation

prabusah
Copy link
Contributor

@prabusah prabusah commented Dec 8, 2019

…lished lambda)

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

Closes #10038

Release note for CHANGELOG:

data source/aws_lambda_function - bug fix - version set to latest published version ($LATEST for unpublished lambda)

Output from acceptance testing:

Did not run acceptance testing...

Please review the changes and provide feedback.
Also require help on how to test the changes in local.

@prabusah prabusah requested a review from a team December 8, 2019 04:43
@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. service/lambda Issues and PRs that pertain to the lambda service. documentation Introduces or discusses updates to documentation. labels Dec 8, 2019
@prabusah prabusah changed the title WIP #10038 Version is set to Latest published version. ($LATEST for unpub… WIP Version is set to Latest published version. ($LATEST for unpub… Dec 15, 2019
@ddriddle
Copy link

CloudFront does not support $LATEST. Are there use cases were $LATEST is desirable for unpublished functions? If not then I recommend that qualified_arn not return a version and just be the same as the unqualified arn in that case. For published versions of course a version number should be returned.

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
@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 Aug 31, 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.

@zhelding zhelding requested review from zhelding and removed request for zhelding August 26, 2022 19:32
@zhelding zhelding self-assigned this Aug 26, 2022
- This follows the pattern used by AWS API GetFunction action
- If no published version: version and qualifier are set to "$LATEST"
@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Sep 1, 2022
@zhelding zhelding changed the title WIP Version is set to Latest published version. ($LATEST for unpub… Set lambda function version to latest published version when no qualifier; set to "$LATEST" when no published version Sep 1, 2022
- Should not write "qualifier" to state when not set by user
- latestVersion resolves to "$LATEST" when no published version exists
- When a qualifier is input: gets returned in qualified ARNs of output
- With no published version: qualified should match unqualified ARN
@zhelding
Copy link
Contributor

zhelding commented Sep 1, 2022

Thanks so much for your original contribution @prabusah! Finally getting this merged 🎉

All acceptance tests are passing:

❯ make testacc TESTS=TestAccLambdaFunctionDataSource_ PKG=lambda    
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20 -run='TestAccLambdaFunctionDataSource_'  -timeout 180m
=== RUN   TestAccLambdaFunctionDataSource_basic
=== RUN   TestAccLambdaFunctionDataSource_version
=== RUN   TestAccLambdaFunctionDataSource_latestVersion
=== RUN   TestAccLambdaFunctionDataSource_unpublishedVersion
=== RUN   TestAccLambdaFunctionDataSource_alias
=== RUN   TestAccLambdaFunctionDataSource_layers
=== RUN   TestAccLambdaFunctionDataSource_vpc
=== RUN   TestAccLambdaFunctionDataSource_environment
=== RUN   TestAccLambdaFunctionDataSource_fileSystem
=== RUN   TestAccLambdaFunctionDataSource_image
=== RUN   TestAccLambdaFunctionDataSource_architectures
=== RUN   TestAccLambdaFunctionDataSource_ephemeralStorage
    function_data_source_test.go:318: AWS_LAMBDA_IMAGE_LATEST_ID env var must be set for Lambda Function Data Source Image Support acceptance tests.
--- SKIP: TestAccLambdaFunctionDataSource_image (0.81s)
--- PASS: TestAccLambdaFunctionDataSource_environment (44.97s)
--- PASS: TestAccLambdaFunctionDataSource_version (49.26s)
--- PASS: TestAccLambdaFunctionDataSource_architectures (55.03s)
--- PASS: TestAccLambdaFunctionDataSource_unpublishedVersion (60.91s)
--- PASS: TestAccLambdaFunctionDataSource_ephemeralStorage (66.90s)
--- PASS: TestAccLambdaFunctionDataSource_basic (72.89s)
--- PASS: TestAccLambdaFunctionDataSource_alias (80.09s)
--- PASS: TestAccLambdaFunctionDataSource_latestVersion (85.07s)
--- PASS: TestAccLambdaFunctionDataSource_layers (92.20s)
--- PASS: TestAccLambdaFunctionDataSource_vpc (1643.50s)
--- PASS: TestAccLambdaFunctionDataSource_fileSystem (1745.92s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lambda     1745.978s

@zhelding zhelding merged commit 5688414 into hashicorp:main Sep 1, 2022
@github-actions github-actions bot added this to the v4.29.0 milestone Sep 1, 2022
gdavison added a commit that referenced this pull request Sep 1, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

This functionality has been released in v4.29.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

github-actions bot commented Oct 4, 2022

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 Oct 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. 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.

Get latest version number of data source aws_lambda_function
4 participants