Merge pull request #7518 from bschwind/patch-1

Update S3 notification documentation
This commit is contained in:
Paul Hinze 2016-07-08 16:53:14 -05:00 committed by GitHub
commit 4f16e71686
1 changed files with 66 additions and 0 deletions

View File

@ -135,6 +135,72 @@ resource "aws_s3_bucket_notification" "bucket_notification" {
}
```
### Add multiple notification configurations to SQS Queue
```
resource "aws_sqs_queue" "queue" {
name = "s3-event-notification-queue"
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
"Condition": {
"ArnEquals": { "aws:SourceArn": "${aws_s3_bucket.bucket.arn}" }
}
}
]
}
POLICY
}
resource "aws_s3_bucket" "bucket" {
bucket = "your_bucket_name"
}
resource "aws_s3_bucket_notification" "bucket_notification" {
bucket = "${aws_s3_bucket.bucket.id}"
queue {
id = "image-upload-event"
queue_arn = "${aws_sqs_queue.queue.arn}"
events = ["s3:ObjectCreated:*"]
filter_prefix = "images/"
}
queue {
id = "video-upload-event"
queue_arn = "${aws_sqs_queue.queue.arn}"
events = ["s3:ObjectCreated:*"]
filter_prefix = "videos/"
}
}
```
For Terraform's [JSON syntax](https://www.terraform.io/docs/configuration/syntax.html), use an array instead of defining the `queue` key twice.
```
{
"bucket": "${aws_s3_bucket.bucket.id}",
"queue": [
{
"id": "image-upload-event",
"queue_arn": "${aws_sqs_queue.queue.arn}",
"events": ["s3:ObjectCreated:*"],
"filter_prefix": "images/"
},
{
"id": "video-upload-event",
"queue_arn": "${aws_sqs_queue.queue.arn}",
"events": ["s3:ObjectCreated:*"],
"filter_prefix": "videos/"
}
]
}
```
## Argument Reference
The following arguments are supported: