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

[Enhancement]: Add REPOSITORY_NAME event type filter to aws_codebuild_webhook resource #38868

Closed
markmullme opened this issue Aug 14, 2024 · 5 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/codebuild Issues and PRs that pertain to the codebuild service.

Comments

@markmullme
Copy link
Contributor

Description

CodeBuild has added a new filter type, REPOSITORY_NAME, to AWS Codebuild webhooks as described here:
https://docs.aws.amazon.com/codebuild/latest/userguide/github-global-organization-webhook.html

and in the SDK here:
https://github.com/aws/aws-sdk-go-v2/blob/main/service/codebuild/types/types.go#L2638

It works with GitHub global or organization webhooks only and allows Codebuild to filter webhook triggers when the repository name matches a regex.

Unfortunately, using REPOSITORY_NAME results in an error:

Error: expected type to be one of ["EVENT" "BASE_REF" "HEAD_REF" "ACTOR_ACCOUNT_ID" "FILE_PATH" "COMMIT_MESSAGE" "WORKFLOW_NAME" "TAG_NAME" "RELEASE_NAME"], got REPOSITORY_NAME

but if the resource is created manually it works and can be imported into state but including REPOSITORY_NAME as shown above will result in this error.

As a workaround I'm considering using a lifecycle such as:

  lifecycle {
    ignore_changes = [
      filter_group,  # TODO: Remove if REPOSITORY_NAME type is supported
    ]
  }

or just using repository webhooks instead of organization webhooks.

Unlike PR #38060 which added support for the WORKFLOW_JOB_QUEUED event pattern, supporting REPOSITORY_NAME requires a new event type which is only available with global/organization webhooks.

Maybe REPOSITORY_NAME would need to be added to the SDK enums here:
https://github.com/aws/aws-sdk-go-v2/blob/main/service/codebuild/types/enums.go

such that WebhookFilterType would actually return REPOSITORY_NAME as a valid type? The SDK repo had a similar issue and gave a response that seems to indicate nothing can be done to fix it in the SDK:
aws/aws-sdk-go-v2#2620 (comment)
since the SDK is directly code generated from the API.

Maybe the terraform provider can overcome this instead?

Affected Resource(s) and/or Data Source(s)

  • aws_codebuild_webhook

Potential Terraform Configuration

resource "aws_codebuild_webhook" "this" {
  project_name = aws_codebuild_project.this.name
  build_type   = "BUILD"

  filter_group {
    filter {
      pattern = "my-repo-name"
      type    = "REPOSITORY_NAME"
    }
  }
}

References

Would you like to implement a fix?

None

@markmullme markmullme added the enhancement Requests to existing resources that expand the functionality or scope. label Aug 14, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/codebuild Issues and PRs that pertain to the codebuild service. label Aug 14, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 14, 2024
@aristosvo
Copy link
Contributor

This issue seems to cover that. As soon as it is released as part of the SDK it will reach the Terraform Provider for AWS in the next SDK update (which is quit often!).

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Aug 26, 2024
@markmullme
Copy link
Contributor Author

This has been fixed with terraform-provider-aws version 5.72.1.

Here's the upstream commit that fixed it:
aws/aws-sdk-go-v2@bf76f90#diff-cd279b0e63e49518b7f662bd2a74c53ccac7786a8d7f50faf36bd873c9878ae9R1051

The related issue has been closed as well:
aws/aws-sdk-go-v2#2746

Thanks all.

Copy link

github-actions bot commented Nov 7, 2024

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/codebuild Issues and PRs that pertain to the codebuild service.
Projects
None yet
Development

No branches or pull requests

3 participants