mineiros-io / terraform-github-repository

A Terraform module to manage GitHub Repositories. https://github.com/
Apache License 2.0
156 stars 100 forks source link

Isn't `branch_protection_v3` superseded by `branch_protection` ? #121

Closed anthr76 closed 2 years ago

anthr76 commented 2 years ago

Hello,

It looks like this module prefers to use branch_protection_v3 rather than branch_protection while the documentation here makes it sound like https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection_v3 branch_protection_v3 is the old resource and we should be preferring branch_protection

As branch_protection uses GraphQL and branch_protection_v3 uses REST

mariux commented 2 years ago

Hi @anthr76,

yes, you are very right, it has been superseeded but so far all features implemented in the module could be done in v3 which has significant performance benefits as the graphql v4 version is very slow when big numbers of repositories and protections are maintained in a single terraform run.

As long as there is no real downside we will stick to defaulting to v3 for the mentioned performance issues we saw when this was introduced into the provider.

We might add support for both versions in the future (as long as the provider also supports both versions) so that users of the module can choose.

Please see also our deprecation notice at https://github.com/mineiros-io/terraform-github-repository#var-branch_protections that makes this plan clear already.

I hope this answers your question. Do you have any features not supported by v3 that you would like to see? If so please open a feature request in a separate issue and we are happy to look into the details.

anthr76 commented 2 years ago

Thanks @mariux for the clear explanation. At least in my eyes it's easier to migrate an existing git repo with branch_protection as it takes a pattern instead of a branch name. Which allows your initial push to be "free". Other than that it seems the performance gains make it worth while to hold out.

Please feel free to close this if there's nothing else worth adding. Thank you!