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

Warning when creating multiple aws_s3_bucket_notification resources on the same bucket #17842

Closed
njlr opened this issue Feb 26, 2021 · 2 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.

Comments

@njlr
Copy link

njlr commented Feb 26, 2021

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

When creating multiple aws_s3_bucket_notification resources on the same bucket, it would be great if Terraform could produce a warning, since this is invalid and can lead to confusing bugs.

New or Affected Resource(s)

  • aws_s3_bucket_notification

Potential Terraform Configuration

This is invalid:

resource "aws_s3_bucket_notification" "foo_writes" {
  bucket = aws_s3_bucket.foo.id

  lambda_function {
    lambda_function_arn = aws_lambda_function.foo.arn
    events              = [ "s3:ObjectCreated:*" ]
  }
}

resource "aws_s3_bucket_notification" "foo_writes2" {
  bucket = aws_s3_bucket.foo.id

  lambda_function {
    lambda_function_arn = aws_lambda_function.bar.arn
    events              = [ "s3:ObjectCreated:*" ]
  }
}

Terraform should warn the user.

This is what should be done instead:

resource "aws_s3_bucket_notification" "foo_writes" {
  bucket = aws_s3_bucket.foo.id

  lambda_function {
    lambda_function_arn = aws_lambda_function.foo.arn
    events              = [ "s3:ObjectCreated:*" ]
  }

  lambda_function {
    lambda_function_arn = aws_lambda_function.bar.arn
    events              = [ "s3:ObjectCreated:*" ]
  }
}
@njlr njlr added the enhancement Requests to existing resources that expand the functionality or scope. label Feb 26, 2021
@ghost ghost added the service/s3 Issues and PRs that pertain to the s3 service. label Feb 26, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 26, 2021
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Mar 1, 2021
@bflad
Copy link
Member

bflad commented Mar 1, 2021

Hi @njlr 👋 Thank you for raising this feature request. Long term, this is likely something we do want to address more holistically for Terraform resources. We have been consolidating these types of requests into #14394 as a single tracking issue for the Terraform AWS Provider and hashicorp/terraform-plugin-sdk#224 in the Terraform Plugin SDK. Please feel free to 👍 react and subscribe to them for further updates and discussions.

@bflad bflad closed this as completed Mar 1, 2021
@ghost
Copy link

ghost commented Mar 31, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 31, 2021
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/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

No branches or pull requests

2 participants