I trying to create s3 event notification for SQS in Terraform
so I navigate the terraform registry and copy there’s code as a start, then I changed naming convension little bit and run
everything were create beside the event notifocation.
can someone know to tell me what wrong here?
this is my module tf file:
data "aws_iam_policy_document" "create-applicant-policy" {
statement {
effect = "Allow"
principals {
type = "*"
identifiers = ["*"]
}
actions = ["sqs:SendMessage"]
resources = ["arn:aws:sqs:*:*:s3-event-notification-queue"]
condition {
test = "ArnEquals"
variable = "aws:SourceArn"
values = [aws_s3_bucket.vardo-assets-bucket.arn]
}
}
}
resource "aws_s3_bucket" "vardo-assets-bucket" {
bucket = var.assets-bucket
}
resource "aws_sqs_queue" "create-applicant-queue" {
name = var.create-applicant-queue
policy = data.aws_iam_policy_document.create-applicant-policy.json
}
resource "aws_s3_bucket_notification" "vardo-assets-bucket-event-notification" {
bucket = aws_s3_bucket.vardo-assets-bucket.id
queue {
queue_arn = aws_sqs_queue.create-applicant-queue.arn
events = ["s3:ObjectCreated:Put"]
filter_prefix = "Prospects/"
filter_suffix = ".pdf"
}
}
and that the error I getting:
Error: creating S3 Bucket (vardo-assets-dev) Notification: operation error S3: PutBucketNotificationConfiguration, https response error StatusCode: 400, RequestID: P23KKT6S8M2T1RZG, HostID: AJhzSoWnHWR/TvUDvoCeDWS3Idb83EhQIDt7QsNhqA90bWu/GXwjnXMJ/s/ty3kGsWQInKbOYvwtee5Z3fhYwg==, api error InvalidArgument: Unable to validate the following destination configurations with module.create-applicant-module.aws_s3_bucket_notification.vardo-assets-bucket-event-notification, on modules/createApplicant/main.tf line 30, in resource “aws_s3_bucket_notification” “vardo-assets-bucket-event-notification”: 30: resource “aws_s3_bucket_notification” “vardo-assets-bucket-event-notification” {
Ozey5540 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.