forked from ExpediaGroup/apiary-lifecycle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam-policy-secretsmanager.tf
40 lines (36 loc) · 961 Bytes
/
iam-policy-secretsmanager.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
/**
* Copyright (C) 2019-2021 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
resource "aws_iam_policy" "beekeeper_ecs_task_exec_docker_registry" {
count = var.docker_registry_auth_secret_name != "" ? 1 : 0
name = "${local.instance_alias}-ecs-task-exec-docker-registry"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": [ "${join("\",\"", concat(data.aws_secretsmanager_secret.docker_registry.*.arn))}" ]
}
]
}
EOF
}
resource "aws_iam_policy" "beekeeper_secrets" {
name = "${local.instance_alias}-secrets-${var.aws_region}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": [ "${data.aws_secretsmanager_secret.beekeeper_db.arn}" ]
}
]
}
EOF
}