Skip to content

Commit

Permalink
fix(DMVP-5761): Fix null policy
Browse files Browse the repository at this point in the history
  • Loading branch information
aramkarapetian committed Nov 12, 2024
1 parent 60a6c0d commit 0ff79b9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions modules/topic/locals.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
locals {
subscriptions_map = { for subscription in var.subscriptions : "${subscription.protocol}:${coalesce(subscription.name, sha256(subscription.endpoint))}" => subscription }
subscriptions_keys = nonsensitive(keys(local.subscriptions_map))

sns_policy = var.policy == null ? {
"Version" : "2008-10-17",
"Id" : "__default_policy_ID",
"Statement" : [
{
"Sid" : "__default_statement_ID",
"Effect" : "Allow",
"Principal" : {
"AWS" : "*"
},
"Action" : [
"SNS:GetTopicAttributes",
"SNS:SetTopicAttributes",
"SNS:AddPermission",
"SNS:RemovePermission",
"SNS:DeleteTopic",
"SNS:Subscribe",
"SNS:ListSubscriptionsByTopic",
"SNS:Publish"
],
"Resource" : "arn:aws:sns:us-east-1:${data.aws_caller_identity.current.account_id}:${var.alarm_actions.topic_name}",
"Condition" : {
"StringEquals" : {
"AWS:SourceOwner" : "${data.aws_caller_identity.current.account_id}"
}
}
}
]
} : var.policy
}

0 comments on commit 0ff79b9

Please sign in to comment.