-
Notifications
You must be signed in to change notification settings - Fork 5
/
policies.tf
48 lines (44 loc) · 1.2 KB
/
policies.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
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
data "aws_iam_policy_document" "api_key_rotation_lambda_assume_role_policy_document" {
statement {
sid = "AWSLambdaCanAssumeThisRole"
effect = "Allow"
actions = [
"sts:AssumeRole"
]
principals {
type = "Service"
identifiers = [
"lambda.amazonaws.com"
]
}
}
}
data "aws_iam_policy_document" "api_key_rotation_lambda_execution_role_policy_document" {
statement {
sid = "AllowSecretsManagerGrafanaApiKey"
effect = "Allow"
actions = [
"secretsmanager:DescribeSecret",
"secretsmanager:GetSecretValue",
"secretsmanager:PutSecretValue",
"secretsmanager:UpdateSecretVersionStage",
"secretsmanager:UpdateSecret"
]
resources = [
aws_secretsmanager_secret.api_key.arn
]
}
statement {
sid = "AllowManagedGrafanaApiKeyManagement"
effect = "Allow"
actions = [
"grafana:CreateWorkspaceApiKey",
"grafana:DeleteWorkspaceApiKey"
]
resources = [
"arn:aws:grafana:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:/workspaces/${var.grafana_workspace_id}"
]
}
}