-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Support AWS CodeBuild using CodeStar Connection #40191
base: main
Are you sure you want to change the base?
Support AWS CodeBuild using CodeStar Connection #40191
Conversation
Community NoteVoting for Prioritization
For Submitters
|
e5900a7
to
05c88f2
Compare
05c88f2
to
aa149b6
Compare
aa149b6
to
239ad38
Compare
239ad38
to
fb1a0d5
Compare
@AP-Hunt I think you forgot to add something like below in tfMap["auth"] = flattenSourceAuth(apiObject.Auth) and func flattenSourceAuth(apiObject *types.SourceAuth) []interface{} {
if apiObject == nil {
return []interface{}{}
}
tfMap := map[string]interface{}{
names.AttrType: apiObject.Type,
"resource": aws.ToString(apiObject.Resource),
}
return []interface{}{tfMap}
} Now the state remains empty and re-applying will see a new change.
@justinretzolk @ewbankkit How can we proceed with this? Especially considering that creating a CodeConnection requires manual action and is difficult to include in the acceptance tests. I'm not sure how to handle this properly. It would be very useful to see this merged soon (see also the upvotes on the original issue). Thanks in advance! |
In August 2024, Amazon announced that AWS CodeBuild now supported using the same GitHub app to access source code in CodeBuild as is used in CodePipeline.[1] This commit adds an optional "auth" block to "source" and "secondary_source" blocks in the aws_codebuild_project resource. That configuration, if present, is translated into the "auth" property of the CreateProject API call.[2] [1] https://aws.amazon.com/about-aws/whats-new/2024/08/aws-codebuild-github-apps-access-source-repositories/ [2] https://docs.aws.amazon.com/codebuild/latest/APIReference/API_ProjectSource.html#CodeBuild-Type-ProjectSource-auth
…credential The code already supported this, but it wasn't documented.
fb1a0d5
to
10a7fe7
Compare
@lvthillo Good catch, thanks for that. I've added it and amended the relevant commit. |
The
It doesn't appear I can re-trigger the job myself, so I think a maintainer will need to do that? |
For anyone wanting to create a GitHub Actions runner in AWS CodeBuild before this PR gets merged, you can create source {
type = "GITHUB"
location = "https://github.com/my/repo"
}
lifecycle {
ignore_changes = [source]
} After Terraform runs, you can modify the project to use the source_json="$(jq \
-rcn \
--arg "codeconnection_arn" "${CODECONNECTION_ARN}" \
'{"type": "GITHUB", "location": "https://github.com/my/repo", "auth": {"type": "CODECONNECTIONS", "resource": $codeconnection_arn}}'
)"
aws codebuild update-project \
--name "codebuild_project" \
--source "${source_json}" |
Description
In August 2024, Amazon announced that AWS CodeBuild now supported using the same GitHub app to access source code in CodeBuild as is used in CodePipeline [1].
This PR adds additional configuration options to the
aws_codebuild_project
resource which get translated into the relevant part of theCreateProject
action in the CodeBuild API [2].It also updates the documentation for the
aws_codebuild_source_credential
resource to include theCODECONNECTIONS
type, which the provider already supported but wasn't documented.I haven't included any additional tests in this change because it's targeting AWS CodeStar Connections, which require a human in the loop to set up. I hope a maintainer can say whether they're happy with this decision, or can suggest a useful test to include.
Relations
Closes #39011
References
[1] https://aws.amazon.com/about-aws/whats-new/2024/08/aws-codebuild-github-apps-access-source-repositories/
[2] https://docs.aws.amazon.com/codebuild/latest/APIReference/API_ProjectSource.html#CodeBuild-Type-ProjectSource-auth
Output from Acceptance Testing
I haven't run the acceptance tests because I'm adding new, optional code branches which the acceptance tests don't cover. It shouldn't have any impact on them.