Terraform
Get an API token for HCP Terraform and Terraform Enterprise
This topic describes how to use the terraform login
and terraform logout
to authenticate with HCP Terraform and Terraform Enterprise.
Hands-on: Try the Authenticate the CLI with HCP Terraform tutorial.
Overview
HCP Terraform and Terraform Enterprise are platforms that perform Terraform runs to provision infrastructure, offering a collaboration-focused environment that makes it easier for teams to use Terraform together.
You can integrate the Terraform CLI with HCP Terraform and Terraform Enterprise in the following ways:
- Use the Terraform CLI as a front-end for CLI-driven runs in HCP Terraform
- Use HCP Terraform or Terraform Enterprise as a state backend and a private module registry.
These integrations require you to authenticate the Terraform CLI with your HCP Terraform account.
Authentication
Run the terraform login
command to generate an API token for your HCP Terraform user account. Refer to the terraform login
command reference documentation for details.
Run the terraform logout
command to end your HCP Terraform or Terraform Enterprise session. Refer to the terraform logout
command reference documentation for details.