CodeBuild: Associating an existing IAM role to a CodeBuild project results in exception
See original GitHub issueDescribe the bug
Creating a new CodeBuild project and associating an existing IAM role results in: Policy must be attached to at least one principal: user, group or role
during synthesis. My best guess is that the default policy generated by CDK is getting orphaned instead of disregarded in the case where an existing IAM role is specified?
To Reproduce Using the following code to make the association:
val codeBuildProjectRole = Role.fromRoleArn(
this,
"code-build-project-role",
"arn:aws:iam::1234567890:role/service-role/codebuild-bruiser-service-role"
)
val projectProps = ProjectProps.builder()
.withEnvironment(buildEnvironment)
.withProjectName(appName)
.withSource(gitHubEnterpriseSource)
.withBuildSpec("buildspec.yml")
.withVpc(props.vpc)
.withRole(codeBuildProjectRole)
.withArtifacts(NoBuildArtifacts())
.withSecondaryArtifacts(
listOf(
s3BucketBuildArtifacts
)
)
.build()
val project = Project(this, "code-build-project", projectProps)
Expected behavior Associating a valid existing role to a CodeBuild project should not result in exception.
Version:
- Ubuntu 18.04
- Kotlin using Java CDK artifacts
- 0.32.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Troubleshooting AWS CodeBuild
Issue: When you try to create or update a build project, you receive the error Code:InvalidInputException, Message:CodeBuild is not authorized to perform: sts: ......
Read more >Unable to update Service Role in CodeBuild with error "The ...
When I create a brand new CodeBuild project, it allows me to select an IAM Service Role, and when I check the box...
Read more >CodeBuild — Boto3 Docs 1.26.35 documentation
The ARN of the IAM role that enables CodeBuild to access the CloudWatch Logs and Amazon S3 artifacts for the project's builds. projectsNotFound...
Read more >Network.AWS.CodeBuild - Hackage
CreateWebhook : For an existing AWS CodeBuild build project that has its source code ... Some AWS operations return results that are incomplete...
Read more >AWS CodeBuild | Noise | Page 3
After you execute the CodeBuild project, you can view the results in three ... resources and their associated IAM roles created by serverless...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem seems to be in the code for IAM: Service Role are supported in CodeBuild, but IAM Policy is expecting a Role Name and not a /path/RoleName:
If I manually change this with:
it works totally fine
Aaah, I get it now 😃. Thanks @pcolazurdo , I’ll try to get this fixed!