Skip to content

chore: migrate releases resource and data source to context-aware fun…#3036

Merged
stevehipwell merged 1 commit intointegrations:mainfrom
tempora-mutantur:main
Jan 16, 2026
Merged

chore: migrate releases resource and data source to context-aware fun…#3036
stevehipwell merged 1 commit intointegrations:mainfrom
tempora-mutantur:main

Conversation

@tempora-mutantur
Copy link
Copy Markdown
Contributor

@tempora-mutantur tempora-mutantur commented Jan 3, 2026

Contributes to #2996

Local tests passed for anonymous, individual, and organization modes.


After the change?

CRUD functions were switched to context-aware versions
https://developer.hashicorp.com/terraform/plugin/sdkv2/guides/v2-upgrade-guide#more-support-for-context-context
*

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

  • Yes
  • No

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 3, 2026

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@tempora-mutantur tempora-mutantur marked this pull request as ready for review January 3, 2026 19:26
@tempora-mutantur tempora-mutantur force-pushed the main branch 2 times, most recently from b0f6a7e to f1cdc37 Compare January 4, 2026 18:32
Copy link
Copy Markdown
Collaborator

@deiga deiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thank you! 🎉

@deiga
Copy link
Copy Markdown
Collaborator

deiga commented Jan 9, 2026

@tempora-mutantur Could you please resolve the conflicts? 🙏

@tempora-mutantur
Copy link
Copy Markdown
Contributor Author

tempora-mutantur commented Jan 10, 2026

@tempora-mutantur Could you please resolve the conflicts? 🙏

Done. Thanks

@tempora-mutantur
Copy link
Copy Markdown
Contributor Author

@deiga

After rebasing, I re-ran tests including the GH_TEST_AUTH_MODE=anonymous configuration. I found that the provider now requires either token or app_auth to be specified (e.g., via GITHUB_TOKEN environment variable). Without it, I get:

        Error: Invalid combination of arguments
        
          with provider["registry.terraform.io/hashicorp/github"],
          on terraform_plugin_test.tf line 2, in provider "github":
           2:           provider "github" {
        
        "token": one of `app_auth,token` must be specified

The issue appears to be caused by using ExactlyOneOf validation in the provider schema:

https://github.com/integrations/terraform-provider-github/blob/main/github/provider.go#L25

ExactlyOneOf requires that exactly one of the specified fields must be set, which prevents anonymous mode from working when neither token nor app_auth are set.

I tested the "can be configured to run anonymously" test case by removing the line

https://github.com/integrations/terraform-provider-github/blob/main/github/provider_test.go#L57

to test this

https://github.com/integrations/terraform-provider-github/blob/main/website/docs/index.html.markdown?plain=1#L32

It failed with: "app_auth": one of 'app_auth,token' must be specified

        Error: Invalid combination of arguments
        
          with provider["registry.terraform.io/hashicorp/github"],
          on terraform_plugin_test.tf line 2, in provider "github":
           2:           provider "github" {
        
        "token": one of `app_auth,token` must be specified

Maybe we could use ConflictsWith instead of ExactlyOneOf if we want to allow providers with no auth config.

@deiga
Copy link
Copy Markdown
Collaborator

deiga commented Jan 10, 2026

@tempora-mutantur I think I actually made the decision conciously that for anonymous access one would need to set token = "" in the provider.

But I didn't document that and I didn't run this past the other maintainers properly either

@deiga
Copy link
Copy Markdown
Collaborator

deiga commented Jan 11, 2026

There is now a PR to address that #3071

Copy link
Copy Markdown
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @tempora-mutantur, I've added some comments.

Copy link
Copy Markdown
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stevehipwell
Copy link
Copy Markdown
Collaborator

@nickfloyd could you please review this.

@stevehipwell stevehipwell added this to the v6.10.0 Release milestone Jan 15, 2026
@stevehipwell
Copy link
Copy Markdown
Collaborator

@tempora-mutantur could you please rebase this PR?

…ctions (integrations#2996)

The legacy CRUD function types are deprecated and should be replaced
with the context-aware versions.
@stevehipwell stevehipwell enabled auto-merge (squash) January 16, 2026 13:17
@stevehipwell stevehipwell merged commit b6fc505 into integrations:main Jan 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants