Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add data sources for listing GitHub App installations in an organization #2573

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

atilsensalduz
Copy link

@atilsensalduz atilsensalduz commented Feb 23, 2025

This PR introduces a new data source, github_app_installations, to enable listing all installed GitHub Apps within an organization. This addition enhances integration with existing resources such as github_app_installation_repository, providing better automation and management capabilities for GitHub App permissions.

What's New?
New Data Source: github_app_installations
Allows fetching all installed GitHub Apps in an organization:

data "github_organization_app_installations" "all_apps" {}

Example Use Case:
This data source can be integrated with the github_app_installation_repository resource to manage app permissions on specific repositories:

# Local value to find the correct app installation by slug
locals {
  # Find the index of the desired app by its slug
  app_index = index(
    data.github_organization_app_installations.all_apps.installations[*].slug,
    "desired-app-name"  # Replace with your actual app slug
  )
  
  # Get the app_id using the found index
  app_installation_id = data.github_organization_app_installations.all_apps.installations[local.app_index].id
}

# Link the repository to the app installation
resource "github_app_installation_repository" "some_app_repo" {
  installation_id = local.app_installation_id
  repository     = github_repository.some_repo.name
}

API Reference: https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization

Related Issue: #2570

…tion

This commit introduces a new data source, 'github_organization_app_installations', to enable listing all installed GitHub Apps within an organization.

References:
- API Documentation: https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization
- Related Issue: integrations#2570

Signed-off-by: atilsensalduz <atil.sensalduz@gmail.com>
@atilsensalduz atilsensalduz changed the title feat: Add data sources for listing GitHub App installations in an organization feat: add data sources for listing GitHub App installations in an organization Feb 23, 2025
…tion

This commit introduces a new data source, 'github_organization_app_installations', to enable listing all installed GitHub Apps within an organization.

References:
- API Documentation: https://docs.github.com/en/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization
- Related Issue: integrations#2570

Signed-off-by: atilsensalduz <atil.sensalduz@gmail.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.

1 participant