OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

I trying to add new s3 event notification resource and get an error

  • Thread starter Thread starter Ozey5540
  • Start date Start date
O

Ozey5540

Guest
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?

Code:
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" {
<p>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.</p>
<p>can someone know to tell me what wrong here?</p>
<pre><code>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"
}
}
</code></pre>
<p>and that the error I getting:</p>
<blockquote>
<p>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" {</p>
</blockquote>
Continue reading...
 
Top