File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Creates a policy to access encrypted parameters in Parameter Store for a given s
8
8
| Name | Description | Type | Default | Required |
9
9
| ------| -------------| :----:| :-----:| :-----:|
10
10
| env | Env for tagging and naming. See [ doc] ( ../README.md#consistent-tagging ) . | string | n/a | yes |
11
+ | extra_services | Extra services to be given parameter read access to, within the same project and environment. | list(string) | ` [] ` | no |
11
12
| parameter\_ store\_ key\_ alias | Alias of the encryption key used to encrypt parameter store values. | string | ` "parameter_store_key" ` | no |
12
13
| project | Project for tagging and naming. See [ doc] ( ../README.md#consistent-tagging ) | string | n/a | yes |
13
14
| region | Region the parameter store values can be read from. Defaults to all. | string | ` "*" ` | no |
Original file line number Diff line number Diff line change 1
1
locals {
2
2
resource_name = " ${ var . project } -${ var . env } -${ var . service } "
3
+ services = concat ([var . service ], var. extra_services )
4
+
5
+ param_resources = [
6
+ for serv in local . services : " arn:aws:ssm:${ var . region } :${ data . aws_caller_identity . current . account_id } :parameter/${ var . project } -${ var . env } -${ serv } /*"
7
+ ]
3
8
}
4
9
5
10
data "aws_caller_identity" "current" {}
@@ -18,7 +23,7 @@ data "aws_iam_policy_document" "policy" {
18
23
" ssm:DescribeParameters" ,
19
24
]
20
25
21
- resources = [ " arn:aws:ssm: ${ var . region } : ${ data . aws_caller_identity . current . account_id } :parameter/ ${ local . resource_name } /* " ]
26
+ resources = local. param_resources
22
27
}
23
28
24
29
statement {
Original file line number Diff line number Diff line change @@ -29,3 +29,9 @@ variable "region" {
29
29
description = " Region the parameter store values can be read from. Defaults to all."
30
30
type = " string"
31
31
}
32
+
33
+ variable "extra_services" {
34
+ type = list (string )
35
+ description = " Extra services to be given parameter read access to, within the same project and environment."
36
+ default = []
37
+ }
You can’t perform that action at this time.
0 commit comments