generated from rhythmictech/terraform-terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
40 lines (33 loc) · 909 Bytes
/
main.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
data "aws_caller_identity" "current" {}
module "tags" {
source = "rhythmictech/tags/terraform"
version = "~> 1.1"
enforce_case = "UPPER"
names = [var.name]
tags = var.tags
}
locals {
tags = module.tags.tags_no_name
}
data "aws_iam_policy_document" "assume_role" {
statement {
actions = ["sts:AssumeRole"]
effect = "Allow"
principals {
type = "Service"
identifiers = ["ssm.amazonaws.com"]
}
}
}
resource "aws_sns_topic" "admin_notifications" {
count = var.enable_sns_notifications ? 1 : 0
name_prefix = "config-remediation-rules"
tags = local.tags
}
data "aws_iam_policy_document" "publish_to_sns" {
statement {
effect = "Allow"
actions = ["sns:Publish"]
resources = [try(aws_sns_topic.admin_notifications[0].arn, "arn:aws:sns:*:${data.aws_caller_identity.current.account_id}:nonexistent-topic")]
}
}