Project: KICS (Provisioning / Security & Compliance)
File: baecd2da-492a-4d59-b9dc-29540a1398e0.md

title: BOM - AWS SQS hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: baecd2da-492a-4d59-b9dc-29540a1398e0 Query name: BOM - AWS SQS Platform: Terraform Severity: <span style="color:#CCCCCC">Trace</span> Category: Bill Of Materials URL: A list of SQS resources specified. Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.<br> ```tf title="Positive test num. 1 - tf file" hl_lines="1" resource "awssqsqueue" "positive1" { name = "terraform-example-queue" delay_seconds = 90 maxmessagesize = 2048 messageretentionseconds = 86400 receivewaittime_seconds = 10 redrive_policy = jsonencode({ deadLetterTargetArn = awssqsqueue.terraformqueuedeadletter.arn maxReceiveCount = 4 }) tags = { Environment = "production" } } resource "awssqsqueue_policy" "positive1" { queueurl = awssqs_queue.positive1.id policy = <<POLICY { "Version": "2012-10-17", "Id": "sqspolicy", "Statement": [ { "Sid": "First", "Effect": "Allow", "Principal": "*", "Action": "sqs:SendMessage", "Resource": "awssqsqueue.positive1.arn" } ] } POLICY } ``` ```tf title="Positive test num. 2 - tf file" hl_lines="1" resource "awssqsqueue" "positive2" { name = "terraform-example-queue" delay_seconds = 90 maxmessagesize = 2048 messageretentionseconds = 86400 receivewaittime_seconds = 10 redrive_policy = jsonencode({ deadLetterTargetArn = awssqsqueue.terraformqueuedeadletter.arn maxReceiveCount = 4 }) tags = { Environment = "production" } } resource "awssqsqueue_policy" "positive2" { queueurl = awssqs_queue.positive2.id policy = <<POLICY { "Version": "2012-10-17", "Id": "sqspolicy", "Statement": [ { "Sid": "First", "Effect": "Allow", "Principal" : { "AWS": [ "arn:aws:iam::123456789012:root", "arn:aws:iam::555555555555:root" ] }, "Action": "sqs:SendMessage", "Resource": "awssqsqueue.positive2.arn" } ] } POLICY } ``` ```tf title="Positive test num. 3 - tf file" hl_lines="1" resource "awssqsqueue" "positive3" { name = "terraform-example-queue" delay_seconds = 90 maxmessagesize = 2048 messageretentionseconds = 86400 receivewaittime_seconds = 10 redrive_policy = jsonencode({ deadLetterTargetArn = awssqsqueue.terraformqueuedeadletter.arn maxReceiveCount = 4 }) tags = { Environment = "production" } policy = <<POLICY { "Version": "2012-10-17", "Id": "sqspolicy", "Statement": [ { "Sid": "First", "Effect": "Allow", "Principal": "*", "Action": "sqs:SendMessage", "Resource": "awssqsqueue.positive3.arn" } ] } POLICY } ``` <details><summary>Positive test num. 4 - tf file</summary> ```tf hl_lines="1" resource "awssqsqueue" "positive4" { name = "terraform-example-queue" delay_seconds = 90 maxmessagesize = 2048 messageretentionseconds = 86400 receivewaittime_seconds = 10 redrive_policy = jsonencode({ deadLetterTargetArn = awssqsqueue.terraformqueuedeadletter.arn maxReceiveCount = 4 }) tags = { Environment = "production" } policy = <<POLICY { "Version": "2012-10-17", "Id": "sqspolicy", "Statement": [ { "Sid": "First", "Effect": "Allow", "Principal" : { "AWS": [ "arn:aws:iam::123456789012:root", "arn:aws:iam::555555555555:root" ] }, "Action": "sqs:SendMessage", "Resource": "awssqsqueue.positive4.arn" } ] } POLICY } ``` </details> <details><summary>Positive test num. 5 - tf file</summary> ```tf hl_lines="1" resource "awssqsqueue" "positive5" { name = "terraform-example-queue" delay_seconds = 90 maxmessagesize = 2048 messageretentionseconds = 86400 receivewaittime_seconds = 10 redrive_policy = jsonencode({ deadLetterTargetArn = awssqsqueue.terraformqueuedeadletter.arn maxReceiveCount = 4 }) tags = { Environment = "production" } sqsmanagedsse_enabled = true } ``` </details> ```tf title="Negative test num. 1 - tf file" module "user_queue" { source = "terraform-aws-modules/sqs/aws" version = "~> 2.0" name = "user" tags = { Service = "user" Environment = "dev" } } ```