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
28d10388
Unverified
Commit
28d10388
authored
Jan 14, 2021
by
Yuji Kinjo
Committed by
GitHub
Jan 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Multiple provider_urls not working with iam-assumable-role-with-oidc (#115)
parent
96d710ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
main.tf
modules/iam-assumable-role-with-oidc/main.tf
+25
-24
No files found.
modules/iam-assumable-role-with-oidc/main.tf
View file @
28d10388
...
...
@@ -5,10 +5,6 @@ locals {
for
url
in
compact
(
distinct
(
concat
(
var
.
provider_urls
,
[
var
.
provider_url
]
)))
:
replace
(
url
,
"https://"
,
""
)
]
identifiers
=
[
for
url
in
local
.
urls
:
"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
))
}
...
...
@@ -19,33 +15,38 @@ data "aws_partition" "current" {}
data
"aws_iam_policy_document"
"assume_role_with_oidc"
{
count
=
var
.
create_role
?
1
:
0
statement
{
effect
=
"Allow"
dynamic
"statement"
{
for_each
=
local
.
urls
actions
=
[
"sts:AssumeRoleWithWebIdentity"
]
content
{
effect
=
"Allow"
principals
{
type
=
"Federated"
actions
=
[
"sts:AssumeRoleWithWebIdentity"
]
identifiers
=
local
.
identifiers
}
principals
{
type
=
"Federated"
dynamic
"condition"
{
for_each
=
length
(
var
.
oidc_fully_qualified_subjects
)
>
0
?
local
.
urls
:
[]
content
{
test
=
"StringEquals"
variable
=
"
${
condition
.
value
}
:sub"
values
=
var
.
oidc_fully_qualified_subjects
identifiers
=
[
"arn:
${data
.
aws_partition
.
current
.
partition
}
:iam::
${
local
.
aws_account_id
}
:oidc-provider/
${
statement
.
value
}
"
]
}
dynamic
"condition"
{
for_each
=
length
(
var
.
oidc_fully_qualified_subjects
)
>
0
?
local
.
urls
:
[]
content
{
test
=
"StringEquals"
variable
=
"
${
statement
.
value
}
:sub"
values
=
var
.
oidc_fully_qualified_subjects
}
}
}
dynamic
"condition"
{
for_each
=
length
(
var
.
oidc_subjects_with_wildcards
)
>
0
?
local
.
urls
:
[]
dynamic
"condition"
{
for_each
=
length
(
var
.
oidc_subjects_with_wildcards
)
>
0
?
local
.
urls
:
[]
content
{
test
=
"StringLike"
variable
=
"
${
condition
.
value
}
:sub"
values
=
var
.
oidc_subjects_with_wildcards
content
{
test
=
"StringLike"
variable
=
"
${
statement
.
value
}
:sub"
values
=
var
.
oidc_subjects_with_wildcards
}
}
}
}
...
...
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