Skip to content

Commit

Permalink
Merge branch 'teams012_fix-sns-topic-data-resource' into teams013
Browse files Browse the repository at this point in the history
  • Loading branch information
razorsedge committed Mar 1, 2021
2 parents 69aea83 + 4911f99 commit 9675db4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
data "aws_sns_topic" "this" {
count = false == var.create_sns_topic && var.create ? 1 : 0

name = var.sns_topic_name
}
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

resource "aws_sns_topic" "this" {
count = var.create_sns_topic && var.create ? 1 : 0
Expand All @@ -15,7 +12,7 @@ resource "aws_sns_topic" "this" {
}

locals {
sns_topic_arn = element(concat(aws_sns_topic.this.*.arn, data.aws_sns_topic.this.*.arn, [""]), 0)
sns_topic_arn = element(concat(aws_sns_topic.this.*.arn, ["arn:aws:sns:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${var.sns_topic_name}"]), 0)

lambda_policy_document = {
sid = "AllowWriteToCloudwatchLogs"
Expand Down

0 comments on commit 9675db4

Please sign in to comment.