-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.tf
95 lines (80 loc) · 2.2 KB
/
data.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# external role (to be assumed by New Relic One)
data "aws_iam_policy_document" "newrelic-one-external-role-trust-policy" {
statement {
sid = "AllowRoleAssumptionByNewRelicOne"
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "AWS"
identifiers = ["754728514883"] # New Relic One account
}
condition {
test = "StringEquals"
variable = "sts:ExternalId"
values = [var.newrelic_trusted_account_id]
}
}
}
data "aws_iam_policy_document" "newrelic-one-external-role-budget-policy" {
statement {
sid = "AllowViewBudget"
effect = "Allow"
actions = ["budgets:ViewBudget"]
resources = ["*"]
}
}
# Kinesis Firehose Delivery Stream
data "aws_iam_policy_document" "kinesis-firehose-stream-role-trust-policy" {
statement {
sid = "AllowRoleAssumptionByKinesisFirehose"
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["firehose.amazonaws.com"]
}
}
}
data "aws_iam_policy_document" "kinesis-firehose-stream-role-s3-policy" {
statement {
sid = "AllowFirehoseS3Access"
effect = "Allow"
actions = [
"s3:AbortMultipartUpload",
"s3:GetBucketLocation",
"s3:GetObject",
"s3:ListBucke",
"s3:ListBucketMultipartUpload",
"s3:PutObject"
]
resources = [
aws_s3_bucket.kinesis-firehose-stream-failed-data.arn,
"${aws_s3_bucket.kinesis-firehose-stream-failed-data.arn}/*"
]
}
}
# CloudWatch Metric Stream
data "aws_iam_policy_document" "cloudwatch-metric-stream-role-trust-policy" {
statement {
sid = "AllowRoleAssumptionByloudWatchMetricStream"
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["streams.metrics.cloudwatch.amazonaws.com"]
}
}
}
data "aws_iam_policy_document" "cloudwatch-metric-stream-role-firehose-policy" {
statement {
sid = "AllowCloudWatchFirehoseAccess"
effect = "Allow"
actions = [
"firehose:PutRecord",
"firehose:PutRecordBatch"
]
resources = [
aws_kinesis_firehose_delivery_stream.kinesis-firehose-stream.arn
]
}
}