Movatterモバイル変換


[0]ホーム

URL:


HashiConf 2025Don't miss the live stream of HashiConf Day 2 happening now View live stream

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.

  1. Ourconfiguration-free GitHub App — we recommend this method for beginning users on HCP Terraform.
  2. 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.
  3. 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.

  1. On HCP Terraform, add a new VCS Provider
  2. On GitHub, create a new OAuth application
  3. On HCP Terraform, set up your provider

Prerequisites

For this tutorial, you will need:

  1. anHCP Terraform account withpermission to manage VCS settings for the organization
  2. 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.

VCS Providers page with the Add a VCS Provider button highlighted

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

Add VCS Provider page with the GitHub dropdown expanded

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

Set up VCS provider with OAuth

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

Create a GitHub OAuth application using the values from the HCP Terraform "Add VCS Provider" page.

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

Values from creating a GitHub OAuth application. You will use these values to set up your 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".

Complete setting up VCS provider by entering GitHub OAuth application's Client ID and Client Secret.

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.

VCS Provider advanced settings page

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.

This tutorial also appears in:

  • 11 tutorials
    Automate Terraform
    Automate Terraform with HCP Terraform and integrate it with third-party CI/CD tools such as GitHub Actions and CircleCI.
    • Terraform

[8]ページ先頭

©2009-2025 Movatter.jp