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
e4184f85
Unverified
Commit
e4184f85
authored
Dec 04, 2020
by
Yuji Kinjo
Committed by
GitHub
Dec 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: automatically determine the number of role policy arns (#119)
parent
355669cf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
4 deletions
+5
-4
.gitignore
.gitignore
+1
-0
main.tf
examples/iam-assumable-role-with-oidc/main.tf
+0
-1
README.md
modules/iam-assumable-role-with-oidc/README.md
+1
-1
main.tf
modules/iam-assumable-role-with-oidc/main.tf
+2
-1
variables.tf
modules/iam-assumable-role-with-oidc/variables.tf
+1
-1
No files found.
.gitignore
View file @
e4184f85
...
@@ -2,3 +2,4 @@
...
@@ -2,3 +2,4 @@
terraform.tfstate
terraform.tfstate
*.tfstate*
*.tfstate*
terraform.tfvars
terraform.tfvars
.terraform.lock.hcl
examples/iam-assumable-role-with-oidc/main.tf
View file @
e4184f85
...
@@ -22,7 +22,6 @@ module "iam_assumable_role_admin" {
...
@@ -22,7 +22,6 @@ 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"
]
}
}
modules/iam-assumable-role-with-oidc/README.md
View file @
e4184f85
...
@@ -28,7 +28,7 @@ This module supports IAM Roles for kubernetes service accounts as described in t
...
@@ -28,7 +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 IAM policies to attach to IAM role |
`number`
|
`
0
`
| no |
| number
\_
of
\_
role
\_
policy
\_
arns | Number of IAM policies to attach to IAM role |
`number`
|
`
null
`
| 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 @
e4184f85
...
@@ -9,6 +9,7 @@ locals {
...
@@ -9,6 +9,7 @@ locals {
for
url
in
local
.
urls
:
for
url
in
local
.
urls
:
"arn:
${data
.
aws_partition
.
current
.
partition
}
:iam::
${
local
.
aws_account_id
}
:oidc-provider/
${
url
}
"
"arn:
${data
.
aws_partition
.
current
.
partition
}
:iam::
${
local
.
aws_account_id
}
:oidc-provider/
${
url
}
"
]
]
number_of_role_policy_arns
=
coalesce
(
var
.
number_of_role_policy_arns
,
length
(
var
.
role_policy_arns
))
}
}
data
"aws_caller_identity"
"current"
{}
data
"aws_caller_identity"
"current"
{}
...
@@ -68,7 +69,7 @@ resource "aws_iam_role" "this" {
...
@@ -68,7 +69,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_role_policy_arns
:
0
count
=
var
.
create_role
?
local
.
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 @
e4184f85
...
@@ -73,7 +73,7 @@ variable "role_policy_arns" {
...
@@ -73,7 +73,7 @@ variable "role_policy_arns" {
variable
"number_of_role_policy_arns"
{
variable
"number_of_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
}
}
...
...
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