File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -118,4 +118,52 @@ data "aws_iam_policy_document" "user_policy" {
118118 ]
119119 resources = [" *" ]
120120 }
121+
122+ statement {
123+ sid = " canassume"
124+ effect = " Allow"
125+
126+ actions = [
127+ " sts:AssumeRole"
128+ ]
129+ resources = [aws_iam_role . secret_reader . arn ]
130+ }
131+ }
132+
133+ resource "aws_iam_role" "secret_reader" {
134+ assume_role_policy = data. aws_iam_policy_document . assume_role_for_secret_reader . json
135+ }
136+
137+ data "aws_iam_policy_document" "assume_role_for_secret_reader" {
138+ statement {
139+ principals {
140+ type = " AWS"
141+ identifiers = [aws_iam_role . user_role . arn ]
142+ }
143+ effect = " Allow"
144+ actions = [" sts:AssumeRole" ]
145+ }
146+ }
147+
148+ resource "aws_iam_role_policy" "user_secret_reader" {
149+ name = " saywhatnow"
150+ role = aws_iam_role. secret_reader . id
151+ policy = data. aws_iam_policy_document . user_secret_reader . json
152+ }
153+
154+ data "aws_iam_policy_document" "user_secret_reader" {
155+ statement {
156+ sid = " readsecrets"
157+ effect = " Allow"
158+
159+ actions = [
160+ " secretsmanager:Describe*" ,
161+ " secretsmanager:Get*" ,
162+ " secretsmanager:List*" ,
163+ " ssm:DescribeParameters" ,
164+ " ssm:GetParameter*"
165+ ]
166+
167+ resources = [" *" ]
168+ }
121169}
You can’t perform that action at this time.
0 commit comments