Skip to content

Commit 82581fd

Browse files
Kevinwochanbryantbiggs
authored andcommitted
docs: added iam role inline policy
1 parent e47c6ed commit 82581fd

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

examples/iam-role/main.tf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,48 @@ module "iam_role_saml" {
187187
tags = local.tags
188188
}
189189

190+
################################################################################
191+
# IAM Role - Inline Policy
192+
################################################################################
193+
194+
module "iam_role_inline_policy" {
195+
source = "../../modules/iam-role"
196+
197+
name = "${local.name}-inline-policy"
198+
199+
create = true
200+
create_inline_policy = true
201+
202+
trust_policy_permissions = {
203+
ec2 = {
204+
effect = "Allow"
205+
actions = [
206+
"sts:AssumeRole"
207+
]
208+
principals = [{
209+
type = "Service"
210+
identifiers = ["ec2.amazonaws.com"]
211+
}]
212+
}
213+
}
214+
215+
inline_policy_permissions = {
216+
S3ReadAccess = {
217+
effect = "Allow"
218+
actions = [
219+
"s3:GetObject",
220+
"s3:ListBucket"
221+
]
222+
resources = [
223+
"arn:aws:s3:::example-bucket",
224+
"arn:aws:s3:::example-bucket/*"
225+
]
226+
}
227+
}
228+
229+
tags = local.tags
230+
}
231+
190232
################################################################################
191233
# Supporting resources
192234
################################################################################

0 commit comments

Comments
 (0)