feat: Add github_enterprise_app_installation resource#3535
Open
slang25 wants to merge 4 commits into
Open
Conversation
Adds a new resource for installing a GitHub App on an enterprise-owned organization via the enterprise organization-installations API, including support for repository_selection = "all". Available on GitHub Enterprise Cloud and GitHub Enterprise Server 3.19+. Resolves integrations#3460 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
👋 Hi, and thank you for this contribution! This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can. You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
Record the enterprise app installation in state as soon as the app is installed, so a failure while granting the remaining (>50) repositories leaves a recoverable resource rather than an orphaned installation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
marcelosinhorini-jet
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3460
Before the change?
There is no way to install a GitHub App on an organization with access to all repositories via Terraform.
github_app_installation_repositoriesonly manages individual repositories on an existing installation, which is impractical for organizations with many repositories and doesn't model the "all repositories" desired state.After the change?
A new
github_enterprise_app_installationresource manages GitHub App installations on enterprise-owned organizations via the enterprise organization-installations API, available on GitHub Enterprise Cloud and GitHub Enterprise Server 3.19+ (verified against the GHES 3.19/3.20 OpenAPI descriptions). The APIs are already present in go-github v89, so no new dependencies.Implementation notes:
<enterprise_slug>:<organization>:<client_id>, so imports need no installation ID lookup;installation_idandapp_slugare computed.all ↔ selectedchanges update in place via the toggle endpoint; repository set changes while stayingselecteduse the grant/revoke endpoints (adding before removing so the selection is never empty). Transitions involvingnoneforce recreation, since the toggle endpoint only acceptsall/selected.selected_repositoriesexactly whenrepository_selection = "selected".GH_TEST_ENTERPRISE_APP_CLIENT_IDenv var (the client ID of an installable app) alongside the existing enterprise test mode, so they skip cleanly where not configured.I don't have access to an enterprise environment, so the CRUD paths have not been exercised against a live API — I'd appreciate a run of the enterprise acceptance tests. Happy to adjust naming/semantics if maintainers prefer a different shape; I noted #3460 is currently labeled blocked pending enterprise-scope work, but this follows the same
enterprise_slugpattern as existing enterprise resources (e.g.github_enterprise_organization).This PR was developed with AI assistance (Claude); I have reviewed the changes.
Pull request checklist
Does this introduce a breaking change?
🤖 Generated with Claude Code