-
Notifications
You must be signed in to change notification settings - Fork 2
/
sink.tf
41 lines (38 loc) · 1.16 KB
/
sink.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
41
data "aws_iam_policy_document" "assume_lambda_role_trust_relationship_document" {
statement {
sid = "1"
actions = [
"sts:AssumeRole"
]
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${data.aws_caller_identity.source.account_id}:role/${var.service_name}-lambda-execution-role"]
}
effect = "Allow"
}
}
data "aws_iam_policy_document" "assume_lambda_policy_document" {
statement {
sid = "1"
actions = [
"kinesis:DescribeStream",
"kinesis:ListStreams",
"kinesis:PutRecord",
"kinesis:PutRecords"
]
resources = [
"arn:aws:kinesis:us-east-1:${data.aws_caller_identity.sink.account_id}:stream/*"
]
effect = "Allow"
}
}
resource "aws_iam_role" "assume_lambda_role" {
provider = aws.sink
name = "${var.service_name}-assume-lambda-role"
assume_role_policy = data.aws_iam_policy_document.assume_lambda_role_trust_relationship_document.json
}
resource "aws_iam_role_policy" "assume_lambda_policy" {
provider = aws.sink
policy = data.aws_iam_policy_document.assume_lambda_policy_document.json
role = aws_iam_role.assume_lambda_role.id
}