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

Add a skip_destroy parameter to aws_lambda_layer_version_permission #23547

Closed
KyleKotowick opened this issue Mar 7, 2022 · 3 comments · Fixed by #29571
Closed

Add a skip_destroy parameter to aws_lambda_layer_version_permission #23547

KyleKotowick opened this issue Mar 7, 2022 · 3 comments · Fixed by #29571
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@KyleKotowick
Copy link
Contributor

KyleKotowick commented Mar 7, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The aws_lambda_layer_version resource has a skip_destroy parameter, which allows you to keep old versions of the layer when you create new ones.

However, the aws_lambda_layer_version_permission resource does not have a corresponding parameter. When this resource is replaced due to a change in the version_number parameter, it removes the policy from the old version and creates the policy for the new version.

There is no way, as far as I can tell, to create a new layer version and new corresponding permission without deleting the permission from the old layer version. The workaround for this is to remove the aws_lambda_layer_version_permission resources from the state file prior to running the apply with the new layer version, but clearly that's not a great approach.

New or Affected Resource(s)

  • aws_lambda_layer_version_permission

Potential Terraform Configuration

resource "aws_lambda_layer_version" "lambda_layer" {
  filename   = "lambda_layer_payload.zip"
  layer_name = "lambda_layer_name"
  compatible_runtimes = ["nodejs12.x"]
  skip_destroy = true
}

resource "aws_lambda_layer_version_permission" "lambda_layer_permission" {
  layer_name     = aws_lambda_layer_version.lambda_layer.layer_arn
  version_number = aws_lambda_layer_version.lambda_layer.version
  principal      = "*"
  action         = "lambda:GetLayerVersion"
  statement_id   = "public-access"

  // This would be the new parameter.
  skip_destroy = aws_lambda_layer_version.lambda_layer.skip_destroy
}
@KyleKotowick KyleKotowick added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 7, 2022
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/lambda Issues and PRs that pertain to the lambda service. labels Mar 7, 2022
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 7, 2022
@James-DeLorenzo
Copy link
Contributor

hi, I've created the above PR that should fix this.

@github-actions github-actions bot added this to the v5.1.0 milestone 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 2, 2023

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 have found a problem that seems similar to this, 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 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants