File tree Expand file tree Collapse file tree
infrastructure/modules/sqs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,36 +19,4 @@ data "aws_iam_policy_document" "sqs_queue" {
1919 identifiers = [var . aws_account_id ]
2020 }
2121 }
22-
23- dynamic "statement" {
24- for_each = var. sns_source_arn != null ? [1 ] : []
25-
26- content {
27- effect = " Allow"
28-
29- principals {
30- type = " Service"
31- identifiers = [
32- " sns.amazonaws.com"
33- ]
34- }
35-
36- actions = [
37- " sqs:SendMessage" ,
38- " sqs:SendMessageBatch" ,
39- ]
40-
41- condition {
42- test = " ArnEquals"
43- variable = " aws:SourceArn"
44- values = [
45- var . sns_source_arn
46- ]
47- }
48-
49- resources = [
50- aws_sqs_queue . sqs_queue . arn ,
51- ]
52- }
53- }
5422}
Original file line number Diff line number Diff line change 11resource "aws_sqs_queue_policy" "sqs_queue_policy" {
22 queue_url = aws_sqs_queue. sqs_queue . id
3- policy = data. aws_iam_policy_document . sqs_queue . json
3+ policy = jsonencode ([
4+ data . aws_iam_policy_document . sqs_queue . json ,
5+ var . sqs_policy_overload ,
6+ ])
47}
Original file line number Diff line number Diff line change @@ -57,10 +57,14 @@ variable "sqs_kms_key_arn" {
5757 description = " ARN of the KMS key to encrypt SQS queue messages"
5858}
5959
60- variable "sns_source_arn " {
60+ variable "sqs_policy_overload " {
6161 type = string
62- description = " ARN of an sns resource allowed to send to this resource "
62+ description = " Optional additional policy to extend the SQS Resource Policy "
6363 default = null
64+ validation {
65+ condition = can (jsondecode (var. sqs_policy_overload ))
66+ error_message = " sqs_policy_overload must be a valid JSON."
67+ }
6468}
6569
6670variable "allowed_arns" {
You can’t perform that action at this time.
0 commit comments