Skip to content

Commit 2d15122

Browse files
authored
Make SNS optional again (#15)
1 parent 396509e commit 2d15122

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data "aws_iam_policy_document" "assume_role" {
2727
}
2828
}
2929

30-
data "aws_iam_policy_document" "default" {
30+
data "aws_iam_policy_document" "es_logs" {
3131
statement {
3232
actions = [
3333
"logs:CreateLogGroup",
@@ -57,7 +57,9 @@ data "aws_iam_policy_document" "default" {
5757
"${var.es_domain_arn}/*",
5858
]
5959
}
60+
}
6061

62+
data "aws_iam_policy_document" "sns" {
6163
statement {
6264
actions = [
6365
"sns:Publish",
@@ -71,6 +73,11 @@ data "aws_iam_policy_document" "default" {
7173
}
7274
}
7375

76+
data "aws_iam_policy_document" "default" {
77+
source_json = "${data.aws_iam_policy_document.es_logs.json}"
78+
override_json = "${length(var.sns_arn) > 0 ? data.aws_iam_policy_document.sns.json : "{}"}"
79+
}
80+
7481
# Modules
7582
#--------------------------------------------------------------
7683
module "label" {

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "security_group_id" {
2-
value = "${join(",",aws_security_group.default.*.id)}"
2+
value = "${join(",", aws_security_group.default.*.id)}"
33
description = "Security Group ID of the Lambda "
44
}

0 commit comments

Comments
 (0)