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
e47ee047
Unverified
Commit
e47ee047
authored
Jun 10, 2020
by
Miguel Ferreira
Committed by
GitHub
Jun 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Fix conditions with multiple subjects in assume role with oidc policy (#74)
parent
2f530de3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
main.tf
examples/iam-assumable-role-with-oidc/main.tf
+2
-0
main.tf
modules/iam-assumable-role-with-oidc/main.tf
+5
-4
variables.tf
modules/iam-assumable-role-with-oidc/variables.tf
+2
-2
No files found.
examples/iam-assumable-role-with-oidc/main.tf
View file @
e47ee047
...
@@ -21,4 +21,6 @@ module "iam_assumable_role_admin" {
...
@@ -21,4 +21,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"
,
]
]
oidc_fully_qualified_subjects
=
[
"system:serviceaccount:default:sa1"
,
"system:serviceaccount:default:sa2"
]
}
}
modules/iam-assumable-role-with-oidc/main.tf
View file @
e47ee047
...
@@ -21,20 +21,21 @@ data "aws_iam_policy_document" "assume_role_with_oidc" {
...
@@ -21,20 +21,21 @@ data "aws_iam_policy_document" "assume_role_with_oidc" {
}
}
dynamic
"condition"
{
dynamic
"condition"
{
for_each
=
var
.
oidc_fully_qualified_subjects
for_each
=
length
(
var
.
oidc_fully_qualified_subjects
)
>
0
?
[
1
]
:
[]
content
{
content
{
test
=
"StringEquals"
test
=
"StringEquals"
variable
=
"
${
var
.
provider_url
}
:sub"
variable
=
"
${
var
.
provider_url
}
:sub"
values
=
[
condition
.
value
]
values
=
var
.
oidc_fully_qualified_subjects
}
}
}
}
dynamic
"condition"
{
dynamic
"condition"
{
for_each
=
var
.
oidc_subjects_with_wildcards
for_each
=
length
(
var
.
oidc_subjects_with_wildcards
)
>
0
?
[
1
]
:
[]
content
{
content
{
test
=
"StringLike"
test
=
"StringLike"
variable
=
"
${
var
.
provider_url
}
:sub"
variable
=
"
${
var
.
provider_url
}
:sub"
values
=
[
condition
.
value
]
values
=
var
.
oidc_subjects_with_wildcards
}
}
}
}
}
}
...
...
modules/iam-assumable-role-with-oidc/variables.tf
View file @
e47ee047
...
@@ -53,13 +53,13 @@ variable "role_policy_arns" {
...
@@ -53,13 +53,13 @@ variable "role_policy_arns" {
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
=
lis
t
(
string
)
type
=
se
t
(
string
)
default
=
[]
default
=
[]
}
}
variable
"oidc_subjects_with_wildcards"
{
variable
"oidc_subjects_with_wildcards"
{
description
=
"The OIDC subject using wildcards to be added to the role policy"
description
=
"The OIDC subject using wildcards to be added to the role policy"
type
=
lis
t
(
string
)
type
=
se
t
(
string
)
default
=
[]
default
=
[]
}
}
...
...
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