sqs.tf 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. resource "aws_sqs_queue" "splunk_deadletter" {
  2. name = "splunk-deadletter"
  3. delay_seconds = 0
  4. max_message_size = 262144
  5. message_retention_seconds = 86400
  6. receive_wait_time_seconds = 0
  7. visibility_timeout_seconds = 300
  8. policy = <<POLICY
  9. {
  10. "Version": "2012-10-17",
  11. "Statement": [
  12. {
  13. "Effect": "Allow",
  14. "Principal": "*",
  15. "Action": "sqs:SendMessage",
  16. "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
  17. "Condition": {
  18. "ArnEquals": { "aws:SourceArn": "${aws_s3_bucket.mbox_splunk_sqs.arn}" }
  19. }
  20. }
  21. ]
  22. }
  23. POLICY
  24. tags = {
  25. Environment = "production"
  26. }
  27. }
  28. resource "aws_sqs_queue" "splunk_s3_queue" {
  29. name = "splunk-s3-queue"
  30. delay_seconds = 0
  31. max_message_size = 262144
  32. message_retention_seconds = 86400
  33. receive_wait_time_seconds = 0
  34. redrive_policy = "{\"deadLetterTargetArn\":\"${aws_sqs_queue.splunk_deadletter.arn}\",\"maxReceiveCount\":4}"
  35. policy = <<POLICY
  36. {
  37. "Version": "2012-10-17",
  38. "Statement": [
  39. {
  40. "Effect": "Allow",
  41. "Principal": {
  42. "AWS": "*"
  43. },
  44. "Action": "sqs:SendMessage",
  45. "Resource": "arn:aws:sqs:*:*:splunk-s3-queue",
  46. "Condition": {
  47. "ArnEquals": { "aws:SourceArn": "${aws_s3_bucket.mbox_splunk_sqs.arn}" }
  48. }
  49. }
  50. ]
  51. }
  52. POLICY
  53. tags = {
  54. Project = "splunk"
  55. }
  56. }