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

Allow for condition on role assumption #24

Closed
cdobbyn opened this issue Mar 1, 2021 · 1 comment · Fixed by #33
Closed

Allow for condition on role assumption #24

cdobbyn opened this issue Mar 1, 2021 · 1 comment · Fixed by #33

Comments

@cdobbyn
Copy link

cdobbyn commented Mar 1, 2021

Describe the Feature

Add the variable condition, what this does is if present it will append the role assumption policy with a condition. This allows for fine tuning what can assume a role.

Expected Behavior

Ability to provide conditions to an assume role policy.

Use Case

The most simple use case I can think of for this is role assumption via an external IDP like Okta. You are assuming the role via a SAML process.

The policy should look like this:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Federated": "arn:aws:iam::1234567890123:saml-provider/Okta"
      },
      "Action": "sts:AssumeRoleWithSAML",
      "Condition": {
        "StringEquals": {
          "SAML:aud": "https://signin.aws.amazon.com/saml"
        }
      }
    }
  ]
}

Describe Ideal Solution

Accept a condition block and if present then use it in the data block for generating the aws iam json policy.

Alternatives Considered

The only alternative at this time after looking through the code for this module is to use the basic terraform aws_iam_role for this.

@Ikana
Copy link

Ikana commented Mar 4, 2021

I looked into forking this repo and adding the functionality but the current way this module defines its Principals is not conducive to having conditions with complicated logic; in the meantime, I will be using the module maybe it will help you too: https://github.com/mineiros-io/terraform-aws-iam-role

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants