-
Notifications
You must be signed in to change notification settings - Fork 1
/
infra_sqs.tf
49 lines (37 loc) · 1.11 KB
/
infra_sqs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
resource "aws_sqs_queue" "video_bucket_main_sqs" {
name = var.main_sqs_queue_name
}
resource "aws_sqs_queue_policy" "namvideo_bucket_main_sqs_policy" {
queue_url = aws_sqs_queue.video_bucket_main_sqs.id
policy = jsonencode({
Version = "2012-10-17",
Statement: [
{
Sid = "Allow S3 to send messages to the queue",
Effect = "Allow",
Principal = {
Service = "s3.amazonaws.com"
},
Action = "SQS:SendMessage",
Resource = aws_sqs_queue.video_bucket_main_sqs.arn,
Condition = {
"ArnEquals" = {
"aws:SourceArn" = aws_s3_bucket.video_bucket.arn
}
}
}
]
})
}
resource "aws_sqs_queue" "video_bucket_sub_sqs" {
name = var.sub_sqs_queue_name
}
# output
output "aws_sqs_ready_queue_url" {
value = aws_sqs_queue.video_bucket_main_sqs.url
sensitive = true
}
output "aws_sqs_in_processing_queue_url" {
value = aws_sqs_queue.video_bucket_sub_sqs.url
sensitive = true
}