Configure GitHub.com access through OAuth
- 3min
- |
- HCP Terraform
- Terraform
HCP Terraform is more powerful when you integrate it with your version control system (VCS). There are three different ways to connect GitHub.com to HCP Terraform.
- Ourconfiguration-free GitHub App — we recommend this method for beginning users on HCP Terraform.
- Configuring GitHub.com access to HCP Terraform through OAuth connection — use this method to manage your HCP Terraform workspaces via theTFE Provider orHCP Terraform API.
- Skip the OAuth configuration process and authenticate with a personal access token. This requires using HCP Terraform's API. For details, see theOAuth Clients API page.
Tip
There are separate instructions to connect HCP Terraform toGitHub Enterprise andother supported VCS providers.
In this tutorial, you will set up GitHub.com OAuth access to HCP Terraform by completing the following three steps.
- On HCP Terraform, add a new VCS Provider
- On GitHub, create a new OAuth application
- On HCP Terraform, set up your provider
Prerequisites
For this tutorial, you will need:
- anHCP Terraform account withpermission to manage VCS settings for the organization
- aGitHub account
On HCP Terraform, add a new VCS Provider
OpenHCP Terraform in your browser and navigate to your organization settings. Then, selectVersion Control | Providers from the left navigation.

Click theAdd a VCS Provider button. SelectGitHub thenGitHub.com (Custom) from the dropdown.

The next page includes instructions to set up your provider by registering a new OAuth application.

On GitHub, create a new OAuth application
In a new browser tab, open GitHub'sRegister a New OAuth Application page.
Fill out the text fields with the values from the HCP Terraform "Add VCS Provider" page. Then, click "Register application".

GitHub should return aClient ID andClient Secret. You will use these values to set up your HCP Terraform VCS provider.

On HCP Terraform, set up your provider
Navigate to the tab you used to create a new VCS provider.
Enter theClient ID andClient Secret from the previous step to finish setting up your VCS provider. Click "Connect and continue".

This takes you to a page on GitHub.com, asking whether you want to authorize the app. Authorize the HCP Terraform app against GitHub by clicking the green "Authorize <GITHUB_USER>" button.
Your browser will return to HCP Terraform. On the Advanced Settings step, you can optionally restrict this VCS provider to selected projects, configure policy sets, modules, and an SSH keypair.

Click "Skip and finish" to finish adding a VCS provider to your HCP Terraform organization.
Next steps
You have successfully configured your HCP Terraform organization to access GitHub.com through OAuth connection.
If you had trouble setting up GitHub OAuth, in-depth instructions can be found on theConfiguring GitHub.com Access (OAuth) documentation page.