Skip to content

feat: Add github_enterprise_app_installation resource#3535

Open
slang25 wants to merge 4 commits into
integrations:mainfrom
slang25:slang25/github-issue-3460-feature
Open

feat: Add github_enterprise_app_installation resource#3535
slang25 wants to merge 4 commits into
integrations:mainfrom
slang25:slang25/github-issue-3460-feature

Conversation

@slang25

@slang25 slang25 commented Jul 13, 2026

Copy link
Copy Markdown

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_repositories only 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_installation resource 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.

resource "github_enterprise_app_installation" "example" {
  enterprise_slug      = "my-enterprise"
  organization         = "my-org"
  client_id            = "Iv1.abc123"
  repository_selection = "all" # or "selected" / "none"
}

Implementation notes:

  • Resource ID is <enterprise_slug>:<organization>:<client_id>, so imports need no installation ID lookup; installation_id and app_slug are computed.
  • all ↔ selected changes update in place via the toggle endpoint; repository set changes while staying selected use the grant/revoke endpoints (adding before removing so the selection is never empty). Transitions involving none force recreation, since the toggle endpoint only accepts all/selected.
  • Repository lists are chunked to respect the API's 50-repositories-per-request limit.
  • Plan-time validation requires selected_repositories exactly when repository_selection = "selected".
  • Acceptance tests are gated on a new GH_TEST_ENTERPRISE_APP_CLIENT_ID env 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_slug pattern 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

  • Schema migrations have been created if needed (example) — not needed, new resource
  • 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

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

👋 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.

slang25 and others added 2 commits July 14, 2026 00:17
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>
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.

[FEAT]: Add support for installing GitHub Apps on all repositories in an organization

2 participants