Error creating CodeBuild project - CodeBuild is not authorized to perform...

0

Hello Everyone, I am trying to build a codebuild CI/CD project on AWS with CodePipeline and Terraform. In fact I am trying to replicate this repo [https://github.com/davoclock/aws-cicd-pipeline] following along with the instructions in this video https://www.youtube.com/watch?v=JwTP3wZHYnU.

When I try to run terraform apply after setting up my pipeline, I get the following error "Error creating CodeBuild project: InvalidInputException: CodeBuild is not authorized to perform: sts:AssumeRole on arn:aws:iam::xxxxxxxxxxxx:role/tf-codebuild-role"

I will greatly appreciate any help with resolving this.

1 個回答
0
已接受的答案

Can you check if your IAM role tf-codebuild-role has the correct trust policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-managingrole-editing-console.html#roles-managingrole_edit-trust-policy)?

It should grant codebuild permission to assume it, i.e.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sts:AssumeRole"
            ],
            "Principal": {
                "Service": [
                    "codebuild.amazonaws.com"
                ]
            }
        }
    ]
}
已回答 2 年前
profile picture
專家
已審閱 7 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南