Skip to content

feat: update to terraform plugin framework#141

Merged
fabiomatavelli-f3 merged 4 commits intomasterfrom
fmatavelli-update-deps
Feb 11, 2026
Merged

feat: update to terraform plugin framework#141
fabiomatavelli-f3 merged 4 commits intomasterfrom
fmatavelli-update-deps

Conversation

@fabiomatavelli-f3
Copy link
Copy Markdown
Contributor

@fabiomatavelli-f3 fabiomatavelli-f3 commented Feb 11, 2026

Summary

Migrate the provider from the deprecated terraform-plugin-sdk (v1) to the modern terraform-plugin-framework.

Motivation

Dependabot attempted to update github.com/hashicorp/go-getter to v1.7.9 (#68), which transitively pulled in github.com/spf13/afero v1.9.2. The newer afero version added a Chown method to the afero.Fs interface, but the terraform-plugin-sdk v1 internally vendors a snapshotFS type that does not implement this new method — causing a compile-time error:

snapshotFS does not implement afero.Fs (missing method Chown)

Since terraform-plugin-sdk v1 is unmaintained and will never receive a fix, the proper solution is to migrate to the terraform-plugin-framework, which does not depend on afero at all.

Changes

Source files

  • main.go — Uses providerserver.Serve() from the framework
  • githubfile/provider.go — Rewritten using the provider.Provider interface (Metadata, Schema, Configure, Resources, DataSources)
  • githubfile/resource_file.go — Rewritten using the resource.Resource interface (Create, Read, Update, Delete, ImportState) with extracted testable business logic functions
  • githubfile/structure_file.go — Simplified to the file struct and parseFileID helper
  • githubfile/provider_test.go — Updated to use providerserver.NewProtocol6WithError and tfprotov6
  • githubfile/resource_file_test.go — Updated to use ProtoV6ProviderFactories and framework-compatible testing

Dependencies

  • Added: terraform-plugin-framework, terraform-plugin-go, terraform-plugin-testing
  • Removed: terraform-plugin-sdk v1 (direct), terraform-provider-github/v5 (direct), afero, go-getter, and ~1M lines of vendored code
  • Removed: vendor/ directory (no longer needed)

Behavioral notes

  • All provider attributes, resource attributes, and their semantics remain unchanged
  • Import ID format remains owner/repo:branch:path
  • ForceNew behavior preserved via stringplanmodifier.RequiresReplace()
  • Archived repository detection on delete is preserved
  • GPG signing support is preserved
  • Environment variable fallbacks (GITHUB_TOKEN, GITHUB_EMAIL, etc.) are preserved

Supersedes

This PR supersedes #68 (Dependabot go-getter bump) by removing the dependency entirely.

@fabiomatavelli-f3 fabiomatavelli-f3 requested a review from a team as a code owner February 11, 2026 13:06
stevo-f3
stevo-f3 previously approved these changes Feb 11, 2026
@fabiomatavelli-f3 fabiomatavelli-f3 merged commit 6f56670 into master Feb 11, 2026
1 check passed
@fabiomatavelli-f3 fabiomatavelli-f3 deleted the fmatavelli-update-deps branch February 11, 2026 13:41
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.

2 participants