Repository navigation
Open
Labels
Status: PinnedA way to keep old or long lived issues aroundType: MaintenanceAny dependency, housekeeping, and clean up Issue or PR
Description
Summary
This issue tracks the migration of all resources and data sources from legacy CRUD functions (Create, Read, Update, Delete) to Context-aware CRUD functions (CreateContext, ReadContext, UpdateContext, DeleteContext).
Why This Migration Is Needed
Per the Terraform Plugin SDK v2 Upgrade Guide:
- Deprecation: The legacy CRUD function types (
CreateFunc,ReadFunc,UpdateFunc,DeleteFunc) are deprecated in favor of their context-aware counterparts - Reliable Timeouts & Cancellation: Context-aware functions plumb
context.Contextthroughout the SDK, enabling better request lifecycle management - Improved Error Handling: Migration to
diag.Diagnosticsallows returning multiple errors and warnings while associating them with specific fields
Related Issues
- [MAINT] Tracking issue for refactoring logging to use
tfloginstead oflog#3070 - [MAINT] Tracking issue for refactoring logging to usetflog- Should be paired with this work sincetflogrequirescontext.Context
Migration Pattern
Before (Legacy)
func resourceGithubExample() *schema.Resource {
return &schema.Resource{
Create: resourceGithubExampleCreate,
Read: resourceGithubExampleRead,
Update: resourceGithubExampleUpdate,
Delete: resourceGithubExampleDelete,
// ...
}
}
func resourceGithubExampleCreate(d *schema.ResourceData, meta interface{}) error {
// ...
return nil
}After (Context-Aware)
func resourceGithubExample() *schema.Resource {
return &schema.Resource{
CreateContext: resourceGithubExampleCreate,
ReadContext: resourceGithubExampleRead,
UpdateContext: resourceGithubExampleUpdate,
DeleteContext: resourceGithubExampleDelete,
// ...
}
}
func resourceGithubExampleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
// Use ctx in API calls for proper cancellation support
// ...
return nil
}Current Status
- Total files: 153
- Already migrated: 20
- Remaining: 133
Migration Checklist
Resources (85 files)
Actions
-
resource_github_actions_environment_secret.go -
resource_github_actions_environment_variable.go -
resource_github_actions_hosted_runner.go -
resource_github_actions_organization_oidc_subject_claim_customization_template.go -
resource_github_actions_organization_permissions.go -
resource_github_actions_organization_secret.go -
resource_github_actions_organization_secret_repositories.go -
resource_github_actions_organization_secret_repository.go -
resource_github_actions_organization_variable.go -
resource_github_actions_repository_access_level.go -
resource_github_actions_repository_oidc_subject_claim_customization_template.go -
resource_github_actions_repository_permissions.go -
resource_github_actions_runner_group.go -
resource_github_actions_secret.go -
resource_github_actions_variable.go
App Installation
-
resource_github_app_installation_repositories.go -
resource_github_app_installation_repository.go
Branch
-
resource_github_branch.go -
resource_github_branch_default.go -
resource_github_branch_protection.go -
resource_github_branch_protection_v3.go
Codespaces
-
resource_github_codespaces_organization_secret.go -
resource_github_codespaces_organization_secret_repositories.go -
resource_github_codespaces_secret.go -
resource_github_codespaces_user_secret.go
Dependabot
-
resource_github_dependabot_organization_secret.go -
resource_github_dependabot_organization_secret_repositories.go -
resource_github_dependabot_secret.go
Enterprise
-
resource_github_enterprise_actions_permissions.go -
resource_github_enterprise_actions_runner_group.go -
resource_github_enterprise_actions_workflow_permissions.go -
resource_github_enterprise_organization.go -
resource_github_enterprise_security_analysis_settings.go
EMU
-
resource_github_emu_group_mapping.go
Issues
-
resource_github_issue.go -
resource_github_issue_label.go -
resource_github_issue_labels.go
Membership
-
resource_github_membership.go✅
Organization
-
resource_github_organization_custom_properties.go -
resource_github_organization_custom_role.go -
resource_github_organization_project.go -
resource_github_organization_repository_role.go✅ -
resource_github_organization_role.go✅ -
resource_github_organization_role_team.go✅ -
resource_github_organization_role_team_assignment.go -
resource_github_organization_role_user.go✅ -
resource_github_organization_ruleset.go✅ -
resource_github_organization_security_manager.go -
resource_github_organization_settings.go -
resource_github_organization_webhook.go -
resource_organization_block.go
Projects
-
resource_github_project_card.go -
resource_github_project_column.go
Release
-
resource_github_release.go
Repository
-
resource_github_repository.go✅ -
resource_github_repository_autolink_reference.go -
resource_github_repository_collaborator.go -
resource_github_repository_collaborators.go -
resource_github_repository_custom_property.go -
resource_github_repository_dependabot_security_updates.go -
resource_github_repository_deploy_key.go -
resource_github_repository_deployment_branch_policy.go -
resource_github_repository_environment.go -
resource_github_repository_environment_deployment_policy.go✅ -
resource_github_repository_file.go -
resource_github_repository_milestone.go -
resource_github_repository_project.go -
resource_github_repository_pull_request.go -
resource_github_repository_ruleset.go✅ -
resource_github_repository_topics.go -
resource_github_repository_webhook.go
Team
-
resource_github_team.go✅ -
resource_github_team_members.go -
resource_github_team_membership.go -
resource_github_team_repository.go -
resource_github_team_settings.go -
resource_github_team_sync_group_mapping.go
User
-
resource_github_user_gpg_key.go -
resource_github_user_invitation_accepter.go -
resource_github_user_ssh_key.go
Workflow
-
resource_github_workflow_repository_permissions.go
Data Sources (72 files)
Actions
-
data_source_github_actions_environment_public_key.go -
data_source_github_actions_environment_secrets.go -
data_source_github_actions_environment_variables.go -
data_source_github_actions_organization_oidc_subject_claim_customization_template.go -
data_source_github_actions_organization_public_key.go -
data_source_github_actions_organization_registration_token.go -
data_source_github_actions_organization_secrets.go -
data_source_github_actions_organization_variables.go -
data_source_github_actions_public_key.go -
data_source_github_actions_registration_token.go -
data_source_github_actions_repository_oidc_subject_claim_customization_template.go -
data_source_github_actions_secrets.go -
data_source_github_actions_variables.go
App
-
data_source_github_app.go -
data_source_github_app_token.go
Branch
-
data_source_github_branch.go -
data_source_github_branch_protection_rules.go
Codespaces
-
data_source_github_codespaces_organization_public_key.go -
data_source_github_codespaces_organization_secrets.go -
data_source_github_codespaces_public_key.go -
data_source_github_codespaces_secrets.go -
data_source_github_codespaces_user_public_key.go -
data_source_github_codespaces_user_secrets.go
Collaborators
-
data_source_github_collaborators.go
Dependabot
-
data_source_github_dependabot_organization_public_key.go -
data_source_github_dependabot_organization_secrets.go -
data_source_github_dependabot_public_key.go -
data_source_github_dependabot_secrets.go
Enterprise
-
data_source_github_enterprise.go
External Groups
-
data_source_github_external_groups.go
IP Ranges
-
data_source_github_ip_ranges.go
Issues
-
data_source_github_issue_labels.go
Membership
-
data_source_github_membership.go
Organization
-
data_source_github_organization.go -
data_source_github_organization_custom_properties.go -
data_source_github_organization_custom_role.go -
data_source_github_organization_external_identities.go -
data_source_github_organization_ip_allow_list.go -
data_source_github_organization_repository_role.go✅ -
data_source_github_organization_repository_roles.go✅ -
data_source_github_organization_role.go✅ -
data_source_github_organization_role_teams.go✅ -
data_source_github_organization_role_users.go✅ -
data_source_github_organization_roles.go✅ -
data_source_github_organization_security_managers.go -
data_source_github_organization_team_sync_groups.go -
data_source_github_organization_teams.go -
data_source_github_organization_webhooks.go
Ref
-
data_source_github_ref.go
Release
-
data_source_github_release.go
Repository
-
data_source_github_repositories.go -
data_source_github_repository.go✅ -
data_source_github_repository_autolink_references.go -
data_source_github_repository_branches.go -
data_source_github_repository_custom_properties.go -
data_source_github_repository_deploy_keys.go -
data_source_github_repository_deployment_branch_policies.go -
data_source_github_repository_environment_deployment_policies.go✅ -
data_source_github_repository_environments.go -
data_source_github_repository_file.go✅ -
data_source_github_repository_milestone.go -
data_source_github_repository_pull_request.go -
data_source_github_repository_pull_requests.go -
data_source_github_repository_teams.go -
data_source_github_repository_webhooks.go
REST API
-
data_source_github_rest_api.go
SSH Keys
-
data_source_github_ssh_keys.go
Team
-
data_source_github_team.go✅
Tree
-
data_source_github_tree.go
User
-
data_source_github_user.go -
data_source_github_user_external_identity.go -
data_source_github_users.go
Suggested Approach
- Pair with tflog migration: When migrating a file, also convert logging to
tflog([MAINT] Tracking issue for refactoring logging to usetfloginstead oflog#3070) - Batch by domain: Group related resources/data sources and migrate them together
- Reference existing migrations: Use already-migrated files as reference implementations
- Update function signatures: Change CRUD function signatures to include
ctx context.Contextand returndiag.Diagnostics - Pass context to API calls: Update go-github client calls to use the context parameter
- Test thoroughly: Ensure acceptance tests pass after each batch migration
References
- Terraform Plugin SDK v2 Upgrade Guide - Context Support
- Example migrated files:
resource_github_membership.go,resource_github_team.go,data_source_github_repository_file.go
Reacted by Steve Hipwell
Metadata
Metadata
Assignees
Labels
Status: PinnedA way to keep old or long lived issues aroundType: MaintenanceAny dependency, housekeeping, and clean up Issue or PR
Activity
github-actions commentedon Dec 10, 2025
👋 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! 🚀stevehipwell commentedon Dec 10, 2025
We will want to add provider scoped timeouts even if we don't expose this as a setting initially. This timeout will be important for rate limit handling, as if the delay is longer than the timeout there is no point waiting so we might as well exit early.
deiga commentedon Dec 10, 2025
@stevehipwell Excellent point. But I wonder if that should be a separate "Epic"?
stevehipwell commentedon Dec 10, 2025
I was thinking of setting a const and requiring the timeouts to be set to that const before we check off the resource. Then it'd be much simpler to refactor it later. This is all just off the top of my head and needs a bit more investigation.
chore: migrate releases resource and data source to context-aware fun…
chore: migrate releases resource and data source to context-aware fun…
chore: migrate releases resource and data source to context-aware fun…
chore: migrate releases resource and data source to context-aware fun…
chore: migrate releases resource and data source to context-aware fun…
refactor(github): migrate actions secret to context-aware CRUD
refactor(actions-org-secret): migrate to context-aware CRUD functions
refactor(org-webhook): migrate to context-aware CRUD functions
refactor(repo-webhook): migrate to context-aware CRUD functions
11 remaining items
chore: migrate releases resource and data source to context-aware fun…
chore: migrate releases resource and data source to context-aware fun…
deiga commentedon Feb 3, 2026
Checklist Update
The following resources were migrated to context-aware CRUD functions in PR #3036 (merged Jan 16, 2026):
Resources
resource_github_release.go✅Data Sources
data_source_github_release.go✅PR Reference: #3036
Note: The new
data_source_github_release_asset.goadded in PR #2514 was implemented with context-aware functions from the start, so no tracking needed.migrate github_user_gpg_key to context-aware CRUD functions
[MAINT] Convert legacy Schema Migrations to use StateUpgraders (integ…
chore: migrate releases resource and data source to context-aware fun…
feat: add fork-PR contributor approval resources and data sources
github-actions commentedon Nov 1, 2026
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!stevehipwell commentedon Nov 27, 2026
@deiga it might be better to update this issue to point at the RESOURCES.md file as the status tracker?