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
f34e1035
Unverified
Commit
f34e1035
authored
Oct 30, 2020
by
Zyntogz
Committed by
GitHub
Oct 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Added number_of_ variables for iam-assumable-role submodules (#96)
parent
cf8f3cce
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
2 deletions
+19
-2
main.tf
examples/iam-assumable-role-with-oidc/main.tf
+1
-0
main.tf
examples/iam-assumable-role/main.tf
+1
-0
README.md
modules/iam-assumable-role-with-oidc/README.md
+1
-0
main.tf
modules/iam-assumable-role-with-oidc/main.tf
+1
-1
variables.tf
modules/iam-assumable-role-with-oidc/variables.tf
+7
-0
README.md
modules/iam-assumable-role/README.md
+1
-0
main.tf
modules/iam-assumable-role/main.tf
+1
-1
variables.tf
modules/iam-assumable-role/variables.tf
+6
-0
No files found.
examples/iam-assumable-role-with-oidc/main.tf
View file @
f34e1035
...
@@ -22,6 +22,7 @@ module "iam_assumable_role_admin" {
...
@@ -22,6 +22,7 @@ module "iam_assumable_role_admin" {
role_policy_arns
=
[
role_policy_arns
=
[
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
,
"arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
,
]
]
number_of_role_policy_arns
=
1
oidc_fully_qualified_subjects
=
[
"system:serviceaccount:default:sa1"
,
"system:serviceaccount:default:sa2"
]
oidc_fully_qualified_subjects
=
[
"system:serviceaccount:default:sa1"
,
"system:serviceaccount:default:sa2"
]
}
}
examples/iam-assumable-role/main.tf
View file @
f34e1035
...
@@ -54,4 +54,5 @@ module "iam_assumable_role_custom" {
...
@@ -54,4 +54,5 @@ module "iam_assumable_role_custom" {
"arn:aws:iam::aws:policy/AmazonCognitoReadOnly"
,
"arn:aws:iam::aws:policy/AmazonCognitoReadOnly"
,
"arn:aws:iam::aws:policy/AlexaForBusinessFullAccess"
,
"arn:aws:iam::aws:policy/AlexaForBusinessFullAccess"
,
]
]
number_of_custom_role_policy_arns
=
2
}
}
modules/iam-assumable-role-with-oidc/README.md
View file @
f34e1035
...
@@ -28,6 +28,7 @@ This module supports IAM Roles for kubernetes service accounts as described in t
...
@@ -28,6 +28,7 @@ This module supports IAM Roles for kubernetes service accounts as described in t
| create
\_
role | Whether to create a role |
`bool`
|
`false`
| no |
| create
\_
role | Whether to create a role |
`bool`
|
`false`
| no |
| 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 |
| number
\_
of
\_
role
\_
policy
\_
arns | Number of custom policies passed to variable role
\_
policy
\_
arns |
`number`
|
`0`
| no |
| oidc
\_
fully
\_
qualified
\_
subjects | The fully qualified OIDC subjects to be added to the role policy |
`set(string)`
|
`[]`
| no |
| oidc
\_
fully
\_
qualified
\_
subjects | The fully qualified OIDC subjects to be added to the role policy |
`set(string)`
|
`[]`
| no |
| oidc
\_
subjects
\_
with
\_
wildcards | The OIDC subject using wildcards to be added to the role policy |
`set(string)`
|
`[]`
| no |
| oidc
\_
subjects
\_
with
\_
wildcards | The OIDC subject using wildcards to be added to the role policy |
`set(string)`
|
`[]`
| no |
| provider
\_
url | URL of the OIDC Provider. Use provider
\_
urls to specify several URLs. |
`string`
|
`""`
| no |
| provider
\_
url | URL of the OIDC Provider. Use provider
\_
urls to specify several URLs. |
`string`
|
`""`
| no |
...
...
modules/iam-assumable-role-with-oidc/main.tf
View file @
f34e1035
...
@@ -68,7 +68,7 @@ resource "aws_iam_role" "this" {
...
@@ -68,7 +68,7 @@ resource "aws_iam_role" "this" {
}
}
resource
"aws_iam_role_policy_attachment"
"custom"
{
resource
"aws_iam_role_policy_attachment"
"custom"
{
count
=
var
.
create_role
?
length
(
var
.
role_policy_arns
)
:
0
count
=
var
.
create_role
?
var
.
number_of_role_policy_arns
:
0
role
=
join
(
""
,
aws_iam_role
.
this
.*.
name
)
role
=
join
(
""
,
aws_iam_role
.
this
.*.
name
)
policy_arn
=
var
.
role_policy_arns
[
count
.
index
]
policy_arn
=
var
.
role_policy_arns
[
count
.
index
]
...
...
modules/iam-assumable-role-with-oidc/variables.tf
View file @
f34e1035
...
@@ -70,6 +70,13 @@ variable "role_policy_arns" {
...
@@ -70,6 +70,13 @@ variable "role_policy_arns" {
default
=
[]
default
=
[]
}
}
variable
"number_of_role_policy_arns"
{
description
=
"Number of IAM policies to attach to IAM role"
type
=
number
default
=
0
}
variable
"oidc_fully_qualified_subjects"
{
variable
"oidc_fully_qualified_subjects"
{
description
=
"The fully qualified OIDC subjects to be added to the role policy"
description
=
"The fully qualified OIDC subjects to be added to the role policy"
type
=
set
(
string
)
type
=
set
(
string
)
...
...
modules/iam-assumable-role/README.md
View file @
f34e1035
...
@@ -32,6 +32,7 @@ Trusted resources can be any [IAM ARNs](https://docs.aws.amazon.com/IAM/latest/U
...
@@ -32,6 +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 custom policies passed to variable custom
\_
role
\_
policy
\_
arns |
`number`
|
`0`
| 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 @
f34e1035
...
@@ -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
?
length
(
var
.
custom_role_policy_arns
)
:
0
count
=
var
.
create_role
?
var
.
number_of_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 @
f34e1035
...
@@ -76,6 +76,12 @@ variable "custom_role_policy_arns" {
...
@@ -76,6 +76,12 @@ variable "custom_role_policy_arns" {
default
=
[]
default
=
[]
}
}
variable
"number_of_custom_role_policy_arns"
{
description
=
"Number of IAM policies to attach to IAM role"
type
=
number
default
=
0
}
# Pre-defined policies
# Pre-defined policies
variable
"admin_role_policy_arn"
{
variable
"admin_role_policy_arn"
{
description
=
"Policy ARN to use for admin role"
description
=
"Policy ARN to use for admin role"
...
...
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