简体   繁体   中英

How to use iam role when creating aws eks cluster with terraform?

I am trying to create aws eks cluster with terraform. I want to use an existing iam role. I won't be creating a new role. I tried this.

module 'eks' {
...
iam_role_arn = "arn:aws:iam::11111111:role/cluster-role"
...
}

But I get 403 permission denied. How can I this?Thanks.

Edit: added error. failed creating IAM Role (green-eks-node-group): AccessDenied: User: arn:aws:iam::*******:user/****** is not authorized to perform: iam:TagRole on resource: arn:aws:iam::*******:role/green-eks-node

First for good measure: Please do not post pictures here of either code or error messages. Just copy paste the stuff and format it.

That said: I think the error tells you exactly what is wrong (or at least what the first error is, because in my experience it takes a few iterations of this to get your IAM permissions straight).

The role that you use you execute terraform does not have the permission:

iam:TagRole

on the resource:

arn:aws:iam:xxxxxxxxxxx:role/eks-cluster

So you will need to add it to it's policy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM