Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Multiple provider_urls not working with iam-assumable-role-with-oidc #115

Merged
merged 3 commits into from
Jan 14, 2021

Conversation

yukin01
Copy link
Contributor

@yukin01 yukin01 commented Nov 20, 2020

Description

fix #114

Motivation and Context

See #114

Breaking Changes

No breaking changes

How Has This Been Tested?

This PR was tested by extending the example provided with the module (examples/iam-assumable-role-with-oidc).
Also see expected output in #114

Terraform plan output

  # module.iam_assumable_role_admin.aws_iam_role.this[0] will be created
  + resource "aws_iam_role" "this" {
      + arn                   = (known after apply)
      + assume_role_policy    = jsonencode(
            {
              + Statement = [
                  + {
                      + Action    = "sts:AssumeRoleWithWebIdentity"
                      + Condition = {
                          + StringEquals = {
                              + oidc.eks.eu-west-1.amazonaws.com/id/AA9E170D464AF7B92084EF72A69B9DC8:sub = [
                                  + "system:serviceaccount:default:sa2",
                                  + "system:serviceaccount:default:sa1",
                                ]
                            }
                        }
                      + Effect    = "Allow"
                      + Principal = {
                          + Federated = "arn:aws:iam::530488130478:oidc-provider/oidc.eks.eu-west-1.amazonaws.com/id/AA9E170D464AF7B92084EF72A69B9DC8"
                        }
                      + Sid       = ""
                    },
                  + {
                      + Action    = "sts:AssumeRoleWithWebIdentity"
                      + Condition = {
                          + StringEquals = {
                              + oidc.eks.eu-west-1.amazonaws.com/id/BA9E170D464AF7B92084EF72A69B9DC8:sub = [
                                  + "system:serviceaccount:default:sa2",
                                  + "system:serviceaccount:default:sa1",
                                ]
                            }
                        }
                      + Effect    = "Allow"
                      + Principal = {
                          + Federated = "arn:aws:iam::530488130478:oidc-provider/oidc.eks.eu-west-1.amazonaws.com/id/BA9E170D464AF7B92084EF72A69B9DC8"
                        }
                      + Sid       = ""
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + create_date           = (known after apply)
      + force_detach_policies = false
      + id                    = (known after apply)
      + max_session_duration  = 3600
      + name                  = "role-with-oidc"
      + path                  = "/"
      + tags                  = {
          + "Role" = "role-with-oidc"
        }
      + unique_id             = (known after apply)
    }

@chancez
Copy link
Contributor

chancez commented Nov 24, 2020

Whoops I guess i missed this when implementing it. Good catch.

@yukin01
Copy link
Contributor Author

yukin01 commented Dec 25, 2020

@antonbabenko
Now that I have resolved the conflicts, could you please review it again?

@antonbabenko antonbabenko merged commit 28d1038 into terraform-aws-modules:master Jan 14, 2021
@antonbabenko
Copy link
Member

Thanks, @yukin01 !

v3.7.0 has been just released.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple provider_urls not working with iam-assumable-role-with-oidc
3 participants