-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatbot.tf
More file actions
45 lines (39 loc) · 1.1 KB
/
chatbot.tf
File metadata and controls
45 lines (39 loc) · 1.1 KB
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
41
42
43
44
45
resource "aws_iam_role" "chatbot" {
name = local.resource_name
tags = local.tags
assume_role_policy = data.aws_iam_policy_document.chatbot_assume.json
}
data "aws_iam_policy_document" "chatbot_assume" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["chatbot.amazonaws.com"]
}
}
}
resource "aws_iam_role_policy" "chatbot" {
name = "chatbot-notifications"
role = aws_iam_role.chatbot.id
policy = data.aws_iam_policy_document.chatbot.json
}
data "aws_iam_policy_document" "chatbot" {
statement {
effect = "Allow"
resources = ["*"]
actions = [
"cloudwatch:Describe*",
"cloudwatch:Get*",
"cloudwatch:List*",
]
}
}
resource "aws_chatbot_slack_channel_configuration" "this" {
configuration_name = local.resource_name
iam_role_arn = aws_iam_role.chatbot.arn
slack_team_id = var.slack_workspace
slack_channel_id = var.channel_name
sns_topic_arns = [aws_sns_topic.notifications.arn]
tags = local.tags
}