HashiCorp Cloud Platform
Connect Infragraph to GitHub
The GitHub connection imports data from GitHub into the resource graph.
Overview
Infragraph uses a GitHub App installed in your organization to authenticate and read GitHub resources. To set up the GitHub connection, you must complete the following steps:
- Create a GitHub App
- Install the GitHub app
- Configure the connection
Create a GitHub App
We recommend you create a dedicated GitHub App for Infragraph. To create a GitHub App, complete the following steps:
In GitHub, go to Settings > Developer settings > GitHub Apps.
Click New GitHub App.
Enter a unique GitHub App name.
Enter any valid URL in the Homepage URL textbox.
Under Webhook, disable the Active option unless you require webhooks for your workflow.
Configure the following repository permissions
Permission Access level Administration Read-only Contents Read-only Metadata Read-only Click Create GitHub App.
After you create the GitHub App, copy the App ID from the GitHub App settings page. You will need this value when you create the Infragraph connection.
Generate a private key
Infragraph uses a private key to authenticate requests to GitHub on behalf of your GitHub App. Complete the following steps to generate and download a private key:
- Open the GitHub App settings page.
- Under Private keys, click Generate a private key.
These steps download a .pem private key file. You will need this private key to create the connection.
Install the GitHub App
Next, complete the following steps to install the GitHub App in your organization:
- Open the GitHub App settings page.
- Click Install App in the left navigation panel.
- Click Install next to the account or organization you want to connect Infragraph to.
- Choose one of the repository access options. You can choose All repositories to give Infragraph access to all current and future repositories or choose Only select repositories to limit access to specific repositories.
- Click Install.
On the installation overview page, copy the Installation ID. You will need this ID to create the connection.
Create the connection
Complete the following steps to create a GitHub connection:
- From the Resource graph Overview, at the top right, click Create Connection.
- Select GitHub from the list of data sources.
- Click Select GitHub.
- Enter your GitHub App ID.
- Click Upload .pem file and upload the private key file you created.
- Enter your GitHub organization ID.
- Enter the Installation ID.
- Click Create connection.
Sync GitHub data
To find the current sync status for your connector, complete the following steps:
- Click Connections in your HCP organization's left navigation panel.
- Check the connection sync status.
Infragraph reports one of the following statuses:
- Awaiting initial sync means that the connection was created but Infragraph has not initiated the first data sync.
- Successful means there were no errors in the latest sync and Infragraph synced the data.
- Partial failure means at least one error occurred in the latest sync.
To manually initiate a new sync, select Sync connection from the … menu in the Actions column.
View GitHub data
To find GitHub data connected to your resource graph, complete any of the following actions:
- Go to the Inventory page. Click an individual resource type to view it in the graph explorer.
- Query resources with a saved query that includes GitHub resources.
- Build the query from scratch using GitHub resources in the query editor.