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

(aws_iam): IRole vs Role - grant_pass_role implementation variance #16214

Closed
travisdieckmann opened this issue Aug 24, 2021 · 2 comments
Closed
Labels
bug This issue is a bug.

Comments

@travisdieckmann
Copy link

Observe linting error when providing aws_iam.Role() object to aws_eks.Cluster() object as "masters_role" parameter:

Argument of type "Role" cannot be assigned to parameter "masters_role" of type "IRole | None" in function "__init__"
  Type "Role" cannot be assigned to type "IRole | None"
    "Role" is incompatible with protocol "IRole"
      "grant_pass_role" is an incompatible type
        Type "(identity: IPrincipal) -> Grant" cannot be assigned to type "(grantee: IPrincipal) -> Grant"
          Parameter name mismatch: "grantee" versus "identity"

Reproduction Steps

from aws_cdk import core, aws_iam, aws_eks


class SomeStack(core.Stack):
    def __init__(self, scope: core.Construct, id: str, **kwargs):
        super().__init__(scope, id, **kwargs)

        my_role = aws_iam.Role(
            self, "my-role", assumed_by=aws_iam.ServicePrincipal("ec2.amazonaws.com")
        )

        my_cluster = aws_eks.Cluster(
            self,
            "my-cluster",
            version=aws_eks.KubernetesVersion().V1_21(),
            masters_role=my_role,
        )

What did you expect to happen?

Linting to pass as aws_iam.Role implements IRole interface.

What actually happened?

Linting error due to IRole interface grant_pass_role accepts parameter "grantee" instead of "identity" as implemented in Key grant_pass_role

Environment

  • CDK CLI Version : 1.119.0 (build 2921d64)
  • Framework Version: 1.119.0
  • Node.js Version: v14.17.0
  • OS : Ubuntu 20.04.3
  • Language (Version): Python (3.8.10) | etc... ] -->

Other


This is 🐛 Bug Report

@travisdieckmann travisdieckmann added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 24, 2021
@peterwoodworth
Copy link
Contributor

Hey @travisdieckmann, sorry for the long wait here

This error is usually caused due to having mismatched cdk versions. All cdk packages installed should be the same version.

If this wasn't your problem, ping me and let me know. Thanks!

@peterwoodworth peterwoodworth removed the needs-triage This issue or PR still needs to be triaged. label Oct 6, 2021
@github-actions
Copy link

github-actions bot commented Oct 6, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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

No branches or pull requests

2 participants