Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-iam
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-iam
Commits
afc9ffa0
Unverified
Commit
afc9ffa0
authored
Dec 04, 2020
by
Anton Babenko
Committed by
GitHub
Dec 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Fixed number of policies everywhere (#121)
parent
70e7898c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
4 deletions
+31
-4
main.tf
examples/iam-assumable-role/main.tf
+28
-1
README.md
modules/iam-assumable-role/README.md
+1
-1
main.tf
modules/iam-assumable-role/main.tf
+1
-1
variables.tf
modules/iam-assumable-role/variables.tf
+1
-1
No files found.
examples/iam-assumable-role/main.tf
View file @
afc9ffa0
...
@@ -53,6 +53,33 @@ module "iam_assumable_role_custom" {
...
@@ -53,6 +53,33 @@ module "iam_assumable_role_custom" {
custom_role_policy_arns
=
[
custom_role_policy_arns
=
[
"arn:aws:iam::aws:policy/AmazonCognitoReadOnly"
,
"arn:aws:iam::aws:policy/AmazonCognitoReadOnly"
,
"arn:aws:iam::aws:policy/AlexaForBusinessFullAccess"
,
"arn:aws:iam::aws:policy/AlexaForBusinessFullAccess"
,
module
.
iam_policy
.
arn
]
]
number_of_custom_role_policy_arns
=
2
# number_of_custom_role_policy_arns = 3
}
#########################################
# IAM policy
#########################################
module
"iam_policy"
{
source
=
"../../modules/iam-policy"
name
=
"example"
path
=
"/"
description
=
"My example policy"
policy
=
<<
EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:Describe*"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
EOF
}
}
modules/iam-assumable-role/README.md
View file @
afc9ffa0
...
@@ -32,7 +32,7 @@ Trusted resources can be any [IAM ARNs](https://docs.aws.amazon.com/IAM/latest/U
...
@@ -32,7 +32,7 @@ Trusted resources can be any [IAM ARNs](https://docs.aws.amazon.com/IAM/latest/U
| force
\_
detach
\_
policies | Whether policies should be detached from this role when destroying |
`bool`
|
`false`
| no |
| force
\_
detach
\_
policies | Whether policies should be detached from this role when destroying |
`bool`
|
`false`
| no |
| max
\_
session
\_
duration | Maximum CLI/API session duration in seconds between 3600 and 43200 |
`number`
|
`3600`
| no |
| max
\_
session
\_
duration | Maximum CLI/API session duration in seconds between 3600 and 43200 |
`number`
|
`3600`
| no |
| mfa
\_
age | Max age of valid MFA (in seconds) for roles which require MFA |
`number`
|
`86400`
| no |
| mfa
\_
age | Max age of valid MFA (in seconds) for roles which require MFA |
`number`
|
`86400`
| no |
| number
\_
of
\_
custom
\_
role
\_
policy
\_
arns | Number of IAM policies to attach to IAM role |
`number`
|
`
0
`
| no |
| number
\_
of
\_
custom
\_
role
\_
policy
\_
arns | Number of IAM policies to attach to IAM role |
`number`
|
`
null
`
| no |
| poweruser
\_
role
\_
policy
\_
arn | Policy ARN to use for poweruser role |
`string`
|
`"arn:aws:iam::aws:policy/PowerUserAccess"`
| no |
| poweruser
\_
role
\_
policy
\_
arn | Policy ARN to use for poweruser role |
`string`
|
`"arn:aws:iam::aws:policy/PowerUserAccess"`
| no |
| readonly
\_
role
\_
policy
\_
arn | Policy ARN to use for readonly role |
`string`
|
`"arn:aws:iam::aws:policy/ReadOnlyAccess"`
| no |
| readonly
\_
role
\_
policy
\_
arn | Policy ARN to use for readonly role |
`string`
|
`"arn:aws:iam::aws:policy/ReadOnlyAccess"`
| no |
| role
\_
description | IAM Role description |
`string`
|
`""`
| no |
| role
\_
description | IAM Role description |
`string`
|
`""`
| no |
...
...
modules/iam-assumable-role/main.tf
View file @
afc9ffa0
...
@@ -72,7 +72,7 @@ resource "aws_iam_role" "this" {
...
@@ -72,7 +72,7 @@ resource "aws_iam_role" "this" {
}
}
resource
"aws_iam_role_policy_attachment"
"custom"
{
resource
"aws_iam_role_policy_attachment"
"custom"
{
count
=
var
.
create_role
?
var
.
number_of_custom_role_policy_arns
:
0
count
=
var
.
create_role
?
coalesce
(
var
.
number_of_custom_role_policy_arns
,
length
(
var
.
custom_role_policy_arns
))
:
0
role
=
aws_iam_role
.
this
[
0
]
.
name
role
=
aws_iam_role
.
this
[
0
]
.
name
policy_arn
=
element
(
var
.
custom_role_policy_arns
,
count
.
index
)
policy_arn
=
element
(
var
.
custom_role_policy_arns
,
count
.
index
)
...
...
modules/iam-assumable-role/variables.tf
View file @
afc9ffa0
...
@@ -79,7 +79,7 @@ variable "custom_role_policy_arns" {
...
@@ -79,7 +79,7 @@ variable "custom_role_policy_arns" {
variable
"number_of_custom_role_policy_arns"
{
variable
"number_of_custom_role_policy_arns"
{
description
=
"Number of IAM policies to attach to IAM role"
description
=
"Number of IAM policies to attach to IAM role"
type
=
number
type
=
number
default
=
0
default
=
null
}
}
# Pre-defined policies
# Pre-defined policies
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment