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_function: Add skip_destroy argument and retry deletion of replicated Lambda@Edge functions #29646

Merged
merged 5 commits into from
Feb 28, 2023

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Feb 24, 2023

Description

Adds the skip_destroy argument and retry (up to a configurable timeout) deletion of replicated Lambda@Edge functions.

Relations

Closes #1721.
Relates #29633.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccLambdaFunction_' PKG=lambda ACCTEST_PARALLELISM=2      
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 2  -run=TestAccLambdaFunction_ -timeout 180m
=== RUN   TestAccLambdaFunction_basic
=== PAUSE TestAccLambdaFunction_basic
=== RUN   TestAccLambdaFunction_disappears
=== PAUSE TestAccLambdaFunction_disappears
=== RUN   TestAccLambdaFunction_tags
=== PAUSE TestAccLambdaFunction_tags
=== RUN   TestAccLambdaFunction_unpublishedCodeUpdate
=== PAUSE TestAccLambdaFunction_unpublishedCodeUpdate
=== RUN   TestAccLambdaFunction_codeSigning
=== PAUSE TestAccLambdaFunction_codeSigning
=== RUN   TestAccLambdaFunction_concurrency
=== PAUSE TestAccLambdaFunction_concurrency
=== RUN   TestAccLambdaFunction_concurrencyCycle
=== PAUSE TestAccLambdaFunction_concurrencyCycle
=== RUN   TestAccLambdaFunction_expectFilenameAndS3Attributes
=== PAUSE TestAccLambdaFunction_expectFilenameAndS3Attributes
=== RUN   TestAccLambdaFunction_envVariables
=== PAUSE TestAccLambdaFunction_envVariables
=== RUN   TestAccLambdaFunction_EnvironmentVariables_noValue
=== PAUSE TestAccLambdaFunction_EnvironmentVariables_noValue
=== RUN   TestAccLambdaFunction_encryptedEnvVariables
=== PAUSE TestAccLambdaFunction_encryptedEnvVariables
=== RUN   TestAccLambdaFunction_nameValidation
=== PAUSE TestAccLambdaFunction_nameValidation
=== RUN   TestAccLambdaFunction_versioned
=== PAUSE TestAccLambdaFunction_versioned
=== RUN   TestAccLambdaFunction_versionedUpdate
=== PAUSE TestAccLambdaFunction_versionedUpdate
=== RUN   TestAccLambdaFunction_enablePublish
=== PAUSE TestAccLambdaFunction_enablePublish
=== RUN   TestAccLambdaFunction_disablePublish
=== PAUSE TestAccLambdaFunction_disablePublish
=== RUN   TestAccLambdaFunction_deadLetter
=== PAUSE TestAccLambdaFunction_deadLetter
=== RUN   TestAccLambdaFunction_deadLetterUpdated
=== PAUSE TestAccLambdaFunction_deadLetterUpdated
=== RUN   TestAccLambdaFunction_nilDeadLetter
=== PAUSE TestAccLambdaFunction_nilDeadLetter
=== RUN   TestAccLambdaFunction_fileSystem
=== PAUSE TestAccLambdaFunction_fileSystem
=== RUN   TestAccLambdaFunction_image
    function_test.go:926: Environment variable AWS_LAMBDA_IMAGE_LATEST_ID is not set
--- SKIP: TestAccLambdaFunction_image (0.00s)
=== RUN   TestAccLambdaFunction_architectures
=== PAUSE TestAccLambdaFunction_architectures
=== RUN   TestAccLambdaFunction_architecturesUpdate
=== PAUSE TestAccLambdaFunction_architecturesUpdate
=== RUN   TestAccLambdaFunction_architecturesWithLayer
=== PAUSE TestAccLambdaFunction_architecturesWithLayer
=== RUN   TestAccLambdaFunction_ephemeralStorage
=== PAUSE TestAccLambdaFunction_ephemeralStorage
=== RUN   TestAccLambdaFunction_tracing
=== PAUSE TestAccLambdaFunction_tracing
=== RUN   TestAccLambdaFunction_KMSKeyARN_noEnvironmentVariables
=== PAUSE TestAccLambdaFunction_KMSKeyARN_noEnvironmentVariables
=== RUN   TestAccLambdaFunction_layers
=== PAUSE TestAccLambdaFunction_layers
=== RUN   TestAccLambdaFunction_layersUpdate
=== PAUSE TestAccLambdaFunction_layersUpdate
=== RUN   TestAccLambdaFunction_vpc
=== PAUSE TestAccLambdaFunction_vpc
=== RUN   TestAccLambdaFunction_vpcRemoval
=== PAUSE TestAccLambdaFunction_vpcRemoval
=== RUN   TestAccLambdaFunction_vpcUpdate
=== PAUSE TestAccLambdaFunction_vpcUpdate
=== RUN   TestAccLambdaFunction_VPC_withInvocation
=== PAUSE TestAccLambdaFunction_VPC_withInvocation
=== RUN   TestAccLambdaFunction_VPCPublishNo_changes
=== PAUSE TestAccLambdaFunction_VPCPublishNo_changes
=== RUN   TestAccLambdaFunction_VPCPublishHas_changes
=== PAUSE TestAccLambdaFunction_VPCPublishHas_changes
=== RUN   TestAccLambdaFunction_VPC_properIAMDependencies
=== PAUSE TestAccLambdaFunction_VPC_properIAMDependencies
=== RUN   TestAccLambdaFunction_VPC_replaceSGWithDefault
=== PAUSE TestAccLambdaFunction_VPC_replaceSGWithDefault
=== RUN   TestAccLambdaFunction_VPC_replaceSGWithCustom
=== PAUSE TestAccLambdaFunction_VPC_replaceSGWithCustom
=== RUN   TestAccLambdaFunction_emptyVPC
=== PAUSE TestAccLambdaFunction_emptyVPC
=== RUN   TestAccLambdaFunction_s3
=== PAUSE TestAccLambdaFunction_s3
=== RUN   TestAccLambdaFunction_localUpdate
=== PAUSE TestAccLambdaFunction_localUpdate
=== RUN   TestAccLambdaFunction_LocalUpdate_nameOnly
=== PAUSE TestAccLambdaFunction_LocalUpdate_nameOnly
=== RUN   TestAccLambdaFunction_S3Update_basic
=== PAUSE TestAccLambdaFunction_S3Update_basic
=== RUN   TestAccLambdaFunction_S3Update_unversioned
=== PAUSE TestAccLambdaFunction_S3Update_unversioned
=== RUN   TestAccLambdaFunction_snapStart
=== PAUSE TestAccLambdaFunction_snapStart
=== RUN   TestAccLambdaFunction_runtimes
=== PAUSE TestAccLambdaFunction_runtimes
=== RUN   TestAccLambdaFunction_Zip_validation
=== PAUSE TestAccLambdaFunction_Zip_validation
=== RUN   TestAccLambdaFunction_skipDestroy
=== PAUSE TestAccLambdaFunction_skipDestroy
=== CONT  TestAccLambdaFunction_basic
=== CONT  TestAccLambdaFunction_tracing
--- PASS: TestAccLambdaFunction_basic (37.48s)
=== CONT  TestAccLambdaFunction_VPC_replaceSGWithCustom
--- PASS: TestAccLambdaFunction_tracing (64.91s)
=== CONT  TestAccLambdaFunction_skipDestroy
--- PASS: TestAccLambdaFunction_skipDestroy (198.24s)
=== CONT  TestAccLambdaFunction_Zip_validation
--- PASS: TestAccLambdaFunction_Zip_validation (4.02s)
=== CONT  TestAccLambdaFunction_runtimes
--- PASS: TestAccLambdaFunction_VPC_replaceSGWithCustom (252.52s)
=== CONT  TestAccLambdaFunction_snapStart
--- PASS: TestAccLambdaFunction_snapStart (56.04s)
=== CONT  TestAccLambdaFunction_S3Update_unversioned
--- PASS: TestAccLambdaFunction_S3Update_unversioned (64.48s)
=== CONT  TestAccLambdaFunction_S3Update_basic
--- PASS: TestAccLambdaFunction_S3Update_basic (61.27s)
=== CONT  TestAccLambdaFunction_LocalUpdate_nameOnly
--- PASS: TestAccLambdaFunction_LocalUpdate_nameOnly (58.13s)
=== CONT  TestAccLambdaFunction_localUpdate
--- PASS: TestAccLambdaFunction_localUpdate (49.32s)
=== CONT  TestAccLambdaFunction_s3
--- PASS: TestAccLambdaFunction_s3 (42.18s)
=== CONT  TestAccLambdaFunction_emptyVPC
--- PASS: TestAccLambdaFunction_emptyVPC (43.77s)
=== CONT  TestAccLambdaFunction_versioned
--- PASS: TestAccLambdaFunction_runtimes (349.62s)
=== CONT  TestAccLambdaFunction_ephemeralStorage
--- PASS: TestAccLambdaFunction_versioned (35.34s)
=== CONT  TestAccLambdaFunction_architecturesWithLayer
--- PASS: TestAccLambdaFunction_ephemeralStorage (56.73s)
=== CONT  TestAccLambdaFunction_architecturesUpdate
--- PASS: TestAccLambdaFunction_architecturesWithLayer (80.36s)
=== CONT  TestAccLambdaFunction_deadLetter
--- PASS: TestAccLambdaFunction_architecturesUpdate (65.45s)
=== CONT  TestAccLambdaFunction_disablePublish
--- PASS: TestAccLambdaFunction_deadLetter (58.88s)
=== CONT  TestAccLambdaFunction_enablePublish
--- PASS: TestAccLambdaFunction_disablePublish (51.97s)
=== CONT  TestAccLambdaFunction_versionedUpdate
=== CONT  TestAccLambdaFunction_fileSystem
--- PASS: TestAccLambdaFunction_enablePublish (64.72s)
--- PASS: TestAccLambdaFunction_versionedUpdate (80.96s)
=== CONT  TestAccLambdaFunction_architectures
--- PASS: TestAccLambdaFunction_architectures (58.64s)
=== CONT  TestAccLambdaFunction_nilDeadLetter
--- PASS: TestAccLambdaFunction_nilDeadLetter (15.04s)
=== CONT  TestAccLambdaFunction_deadLetterUpdated
--- PASS: TestAccLambdaFunction_deadLetterUpdated (235.09s)
=== CONT  TestAccLambdaFunction_concurrencyCycle
--- PASS: TestAccLambdaFunction_concurrencyCycle (66.70s)
=== CONT  TestAccLambdaFunction_nameValidation
--- PASS: TestAccLambdaFunction_nameValidation (1.18s)
=== CONT  TestAccLambdaFunction_encryptedEnvVariables
--- PASS: TestAccLambdaFunction_encryptedEnvVariables (78.22s)
=== CONT  TestAccLambdaFunction_EnvironmentVariables_noValue
--- PASS: TestAccLambdaFunction_EnvironmentVariables_noValue (43.67s)
=== CONT  TestAccLambdaFunction_unpublishedCodeUpdate
--- PASS: TestAccLambdaFunction_unpublishedCodeUpdate (64.07s)
=== CONT  TestAccLambdaFunction_envVariables
--- PASS: TestAccLambdaFunction_envVariables (95.93s)
=== CONT  TestAccLambdaFunction_expectFilenameAndS3Attributes
--- PASS: TestAccLambdaFunction_expectFilenameAndS3Attributes (1.18s)
=== CONT  TestAccLambdaFunction_vpcUpdate
--- PASS: TestAccLambdaFunction_fileSystem (862.39s)
=== CONT  TestAccLambdaFunction_VPC_replaceSGWithDefault
--- PASS: TestAccLambdaFunction_VPC_replaceSGWithDefault (266.95s)
=== CONT  TestAccLambdaFunction_VPC_properIAMDependencies
--- PASS: TestAccLambdaFunction_VPC_properIAMDependencies (1330.94s)
=== CONT  TestAccLambdaFunction_VPCPublishHas_changes
--- PASS: TestAccLambdaFunction_vpcUpdate (1782.28s)
=== CONT  TestAccLambdaFunction_VPCPublishNo_changes
--- PASS: TestAccLambdaFunction_VPCPublishHas_changes (280.84s)
=== CONT  TestAccLambdaFunction_VPC_withInvocation
--- PASS: TestAccLambdaFunction_VPCPublishNo_changes (1763.72s)
=== CONT  TestAccLambdaFunction_layers
--- PASS: TestAccLambdaFunction_layers (48.44s)
=== CONT  TestAccLambdaFunction_vpcRemoval
--- PASS: TestAccLambdaFunction_VPC_withInvocation (1651.20s)
=== CONT  TestAccLambdaFunction_concurrency
--- PASS: TestAccLambdaFunction_vpcRemoval (255.33s)
=== CONT  TestAccLambdaFunction_KMSKeyARN_noEnvironmentVariables
--- PASS: TestAccLambdaFunction_concurrency (141.68s)
=== CONT  TestAccLambdaFunction_tags
--- PASS: TestAccLambdaFunction_KMSKeyARN_noEnvironmentVariables (56.81s)
=== CONT  TestAccLambdaFunction_disappears
--- PASS: TestAccLambdaFunction_tags (86.90s)
=== CONT  TestAccLambdaFunction_codeSigning
--- PASS: TestAccLambdaFunction_disappears (46.06s)
=== CONT  TestAccLambdaFunction_vpc
--- PASS: TestAccLambdaFunction_codeSigning (75.25s)
=== CONT  TestAccLambdaFunction_layersUpdate
--- PASS: TestAccLambdaFunction_layersUpdate (204.05s)
--- PASS: TestAccLambdaFunction_vpc (1594.62s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lambda	7084.173s

Acceptance test output:

% make testacc TESTARGS='-run=TestAccLambdaFunction_basic\|TestAccLambdaFunction_skipDestroy\|TestAccLambdaFunction_disappears' PKG=lambda ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 3  -run=TestAccLambdaFunction_basic\|TestAccLambdaFunction_skipDestroy\|TestAccLambdaFunction_disappears -timeout 180m
=== RUN   TestAccLambdaFunction_basic
=== PAUSE TestAccLambdaFunction_basic
=== RUN   TestAccLambdaFunction_disappears
=== PAUSE TestAccLambdaFunction_disappears
=== RUN   TestAccLambdaFunction_skipDestroy
=== PAUSE TestAccLambdaFunction_skipDestroy
=== CONT  TestAccLambdaFunction_basic
=== CONT  TestAccLambdaFunction_skipDestroy
=== CONT  TestAccLambdaFunction_disappears
--- PASS: TestAccLambdaFunction_disappears (37.24s)
--- PASS: TestAccLambdaFunction_basic (45.85s)
--- PASS: TestAccLambdaFunction_skipDestroy (48.66s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lambda	54.571s
@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. and removed documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/lambda Issues and PRs that pertain to the lambda service. labels Feb 24, 2023
@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. labels Feb 24, 2023
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

$ make testacc PKG=lambda TESTS=TestAccLambdaFunction_
--- PASS: TestAccLambdaFunction_Zip_validation (7.99s)
=== CONT  TestAccLambdaFunction_VPCPublishNo_changes
--- PASS: TestAccLambdaFunction_s3 (38.67s)
=== CONT  TestAccLambdaFunction_VPC_withInvocation
--- PASS: TestAccLambdaFunction_skipDestroy (45.94s)
=== CONT  TestAccLambdaFunction_vpcUpdate
--- PASS: TestAccLambdaFunction_S3Update_unversioned (58.58s)
=== CONT  TestAccLambdaFunction_vpcRemoval
--- PASS: TestAccLambdaFunction_S3Update_basic (60.29s)
=== CONT  TestAccLambdaFunction_vpc
--- PASS: TestAccLambdaFunction_versioned (60.95s)
=== CONT  TestAccLambdaFunction_layersUpdate
--- PASS: TestAccLambdaFunction_emptyVPC (67.06s)
=== CONT  TestAccLambdaFunction_layers
--- PASS: TestAccLambdaFunction_tracing (73.01s)
=== CONT  TestAccLambdaFunction_KMSKeyARN_noEnvironmentVariables
--- PASS: TestAccLambdaFunction_basic (73.12s)
=== CONT  TestAccLambdaFunction_architectures
--- PASS: TestAccLambdaFunction_nilDeadLetter (76.22s)
=== CONT  TestAccLambdaFunction_architecturesUpdate
--- PASS: TestAccLambdaFunction_snapStart (103.18s)
=== CONT  TestAccLambdaFunction_fileSystem
--- PASS: TestAccLambdaFunction_ephemeralStorage (108.91s)
=== CONT  TestAccLambdaFunction_concurrencyCycle
--- PASS: TestAccLambdaFunction_VPC_replaceSGWithDefault (311.86s)
=== CONT  TestAccLambdaFunction_nameValidation
--- PASS: TestAccLambdaFunction_nameValidation (0.79s)
=== CONT  TestAccLambdaFunction_encryptedEnvVariables
--- PASS: TestAccLambdaFunction_runtimes (348.13s)
=== CONT  TestAccLambdaFunction_EnvironmentVariables_noValue
--- PASS: TestAccLambdaFunction_VPC_properIAMDependencies (514.65s)
=== CONT  TestAccLambdaFunction_disablePublish
--- PASS: TestAccLambdaFunction_VPC_replaceSGWithCustom (697.70s)
=== CONT  TestAccLambdaFunction_envVariables
--- PASS: TestAccLambdaFunction_VPCPublishHas_changes (909.89s)
=== CONT  TestAccLambdaFunction_deadLetterUpdated
--- PASS: TestAccLambdaFunction_localUpdate (1063.56s)
=== CONT  TestAccLambdaFunction_deadLetter
--- PASS: TestAccLambdaFunction_LocalUpdate_nameOnly (1069.45s)
=== CONT  TestAccLambdaFunction_expectFilenameAndS3Attributes
--- PASS: TestAccLambdaFunction_expectFilenameAndS3Attributes (0.83s)
=== CONT  TestAccLambdaFunction_unpublishedCodeUpdate
--- PASS: TestAccLambdaFunction_VPCPublishNo_changes (1415.79s)
=== CONT  TestAccLambdaFunction_concurrency
--- PASS: TestAccLambdaFunction_VPC_withInvocation (1559.14s)
=== CONT  TestAccLambdaFunction_codeSigning
--- PASS: TestAccLambdaFunction_vpcRemoval (1612.40s)
=== CONT  TestAccLambdaFunction_tags
--- PASS: TestAccLambdaFunction_architectures (1796.60s)
=== CONT  TestAccLambdaFunction_disappears
--- PASS: TestAccLambdaFunction_KMSKeyARN_noEnvironmentVariables (1798.17s)
=== CONT  TestAccLambdaFunction_versionedUpdate
--- PASS: TestAccLambdaFunction_layersUpdate (1811.93s)
=== CONT  TestAccLambdaFunction_enablePublish
--- PASS: TestAccLambdaFunction_layers (1814.34s)
--- PASS: TestAccLambdaFunction_concurrencyCycle (1803.94s)
--- PASS: TestAccLambdaFunction_vpcUpdate (1978.74s)
--- PASS: TestAccLambdaFunction_vpc (1968.02s)
--- PASS: TestAccLambdaFunction_EnvironmentVariables_noValue (1744.20s)
--- PASS: TestAccLambdaFunction_architecturesWithLayer (2106.07s)
--- PASS: TestAccLambdaFunction_disablePublish (1596.66s)
--- PASS: TestAccLambdaFunction_encryptedEnvVariables (1811.04s)
--- PASS: TestAccLambdaFunction_deadLetterUpdated (1228.31s)
--- PASS: TestAccLambdaFunction_deadLetter (1081.30s)
--- PASS: TestAccLambdaFunction_concurrency (728.26s)
--- PASS: TestAccLambdaFunction_architecturesUpdate (2078.81s)
--- PASS: TestAccLambdaFunction_disappears (291.54s)
--- PASS: TestAccLambdaFunction_codeSigning (568.70s)
--- PASS: TestAccLambdaFunction_envVariables (1471.22s)
--- PASS: TestAccLambdaFunction_tags (506.03s)
--- PASS: TestAccLambdaFunction_unpublishedCodeUpdate (1110.81s)
--- PASS: TestAccLambdaFunction_enablePublish (327.08s)
--- PASS: TestAccLambdaFunction_versionedUpdate (335.24s)
--- PASS: TestAccLambdaFunction_fileSystem (2331.73s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lambda     2438.112s

@ewbankkit ewbankkit merged commit bdddbfd into main Feb 28, 2023
@ewbankkit ewbankkit deleted the f-aws_lambda_function.skip_destroy branch February 28, 2023 13:23
@github-actions github-actions bot added this to the v4.57.0 milestone Feb 28, 2023
github-actions bot pushed a commit that referenced this pull request Feb 28, 2023
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This functionality has been released in v4.57.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 Apr 4, 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 Apr 4, 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.

Do not try to delete lambda@edge functions with replicas
2 participants