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_provisioned_concurrency_configuration: add skip_destroy argument #31646

Merged
merged 3 commits into from
Jun 1, 2023

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented May 30, 2023

Description

Adds a skip_destroy argument, allowing the preservation of provisioned concurrency configurations when lambda function versions are updated.

Relations

Closes #31645

Output from Acceptance Testing

$ SKIP_DESTROY_ENABLED=true make testacc PKG=lambda TESTS=TestAccLambdaProvisionedConcurrencyConfig_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20 -run='TestAccLambdaProvisionedConcurrencyConfig_'  -timeout 180m
=== RUN   TestAccLambdaProvisionedConcurrencyConfig_basic
=== PAUSE TestAccLambdaProvisionedConcurrencyConfig_basic
=== RUN   TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaFunction
=== PAUSE TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaFunction
=== RUN   TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaProvisionedConcurrency
=== PAUSE TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaProvisionedConcurrency
=== RUN   TestAccLambdaProvisionedConcurrencyConfig_provisionedConcurrentExecutions
=== PAUSE TestAccLambdaProvisionedConcurrencyConfig_provisionedConcurrentExecutions
=== RUN   TestAccLambdaProvisionedConcurrencyConfig_Qualifier_aliasName
=== PAUSE TestAccLambdaProvisionedConcurrencyConfig_Qualifier_aliasName
=== RUN   TestAccLambdaProvisionedConcurrencyConfig_skipDestroy
=== PAUSE TestAccLambdaProvisionedConcurrencyConfig_skipDestroy
=== CONT  TestAccLambdaProvisionedConcurrencyConfig_basic
=== CONT  TestAccLambdaProvisionedConcurrencyConfig_provisionedConcurrentExecutions
=== CONT  TestAccLambdaProvisionedConcurrencyConfig_skipDestroy
=== CONT  TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaProvisionedConcurrency
=== CONT  TestAccLambdaProvisionedConcurrencyConfig_Qualifier_aliasName
=== CONT  TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaFunction
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_skipDestroy (187.75s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaFunction (201.64s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaProvisionedConcurrency (206.41s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_basic (206.54s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_Qualifier_aliasName (222.91s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_provisionedConcurrentExecutions (373.41s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lambda     376.666s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/lambda Issues and PRs that pertain to the lambda service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. labels May 30, 2023
@jar-b jar-b marked this pull request as ready for review May 30, 2023 16:32
@gdavison gdavison self-assigned this May 30, 2023
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.

Looks good. I have a comment about the added test

ErrorCheck: acctest.ErrorCheck(t, names.LambdaEndpointID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckProvisionedConcurrencyConfigNoDestroy(ctx),
Steps: []resource.TestStep{
Copy link
Contributor

Choose a reason for hiding this comment

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

We could test this without the environment variable by using the following test steps, which would also test the originally reported problem

  1. Create
  2. Publish a new version of the function, but validate that the old version of the function still has concurrency set
  3. Delete if from the new version, and validate that it's still set on the new version

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion - I've updated to this pattern and we shouldn't have any dangling resources leftover now.

@jar-b
Copy link
Member Author

jar-b commented Jun 1, 2023

Test results post _skipDestroy updates:

$ make testacc PKG=lambda TESTS=TestAccLambdaProvisionedConcurrencyConfig_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20 -run='TestAccLambdaProvisionedConcurrencyConfig_'  -timeout 180m

--- PASS: TestAccLambdaProvisionedConcurrencyConfig_Qualifier_aliasName (173.96s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaFunction (188.80s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_Disappears_lambdaProvisionedConcurrency (205.29s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_basic (260.23s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_skipDestroy (347.22s)
--- PASS: TestAccLambdaProvisionedConcurrencyConfig_provisionedConcurrentExecutions (437.56s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lambda     440.827s

@jar-b jar-b merged commit 451166b into main Jun 1, 2023
@jar-b jar-b deleted the f-aws_lambda_provisioned_concurrency-skip_destroy branch June 1, 2023 13:44
@github-actions github-actions bot added this to the v5.1.0 milestone Jun 1, 2023
github-actions bot pushed a commit that referenced this pull request Jun 1, 2023
@github-actions
Copy link

github-actions bot commented Jun 1, 2023

This functionality has been released in v5.1.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 Jul 3, 2023

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 3, 2023
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. service/lambda Issues and PRs that pertain to the lambda service. size/L 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.

[Enhancement]: Add ability to skip destruction of Lambda Provisioned Concurrency Configurations
2 participants