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

feat: Explicit self-assume permission for IAM assumable role with OIDC #278

Conversation

miklapko
Copy link

@miklapko miklapko commented Sep 22, 2022

Description

Adds the ability to implement self-assume permission for IAM assumable role with OIDC.

Motivation and Context

AWS is changing the way IAM role trust policies work. Before, they implicitly allowed the role to assume itself. After the change, an explicit permission is needed.

Breaking Changes

No.

How Has This Been Tested?

Tested via Terraform Enterprise on multiple environments, with prior config (without the new variable input) and with explicit_permission_to_assume_self = true.

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Minor comments. Thanks for the quick addition.

@FernandoMiguel
Copy link
Contributor

this is great work.
can this be mirrored for the https://github.com/terraform-aws-modules/terraform-aws-iam/tree/master/modules/iam-role-for-service-accounts-eks module too ?

@@ -62,6 +62,28 @@ data "aws_iam_policy_document" "assume_role_with_oidc" {
}
}

data "aws_iam_policy_document" "assume_self" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of a new document data source and then merging documents, we can use a dynamic statement block instead like

  dynamic "statement" {
    for_each = var.explicit_permission_to_assume_self ? [1] : []
    
    content {
      ...
    }
  }

@bryantbiggs
Copy link
Member

this is great work. can this be mirrored for the master/modules/iam-role-for-service-accounts-eks module too ?

yes - @miklapko can we add this to all roles that are supported in this project please

@FernandoMiguel
Copy link
Contributor

thanks folks.
this is currently blocking us, from using argocd.
we have an aws support ticket open and our TAM is involved too. they were the ones linking this PR to us.

Add Govcloud and CN support

Co-authored-by: Peter Rifel <rifelpet@users.noreply.github.com>
@antonbabenko
Copy link
Member

This issue has been resolved in version 5.5.0 🎉

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

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 8, 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.

5 participants