← 返回命令列表

Linux command

terraform-login 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Log in

terraform login

Log in

terraform login [hostname]

说明

terraform login obtains and saves an API token for HCP Terraform (formerly Terraform Cloud), Terraform Enterprise, or any host implementing the Terraform login protocol. The command launches a web browser directing the user to the service's login page. After authorization, Terraform receives an API token via OAuth 2.0 with PKCE and saves it locally. By default, the token is stored in plain text in ~/.terraform.d/credentials.tfrc.json. Alternatively, a credentials helper can be configured to store tokens in an external secrets management system.

参数

hostname
The hostname of the Terraform service to authenticate against. Defaults to app.terraform.io (HCP Terraform). For Terraform Enterprise, specify your organization's hostname

FAQ

What is the terraform-login command used for?

terraform login obtains and saves an API token for HCP Terraform (formerly Terraform Cloud), Terraform Enterprise, or any host implementing the Terraform login protocol. The command launches a web browser directing the user to the service's login page. After authorization, Terraform receives an API token via OAuth 2.0 with PKCE and saves it locally. By default, the token is stored in plain text in ~/.terraform.d/credentials.tfrc.json. Alternatively, a credentials helper can be configured to store tokens in an external secrets management system.

How do I run a basic terraform-login example?

Run `terraform login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does hostname do in terraform-login?

The hostname of the Terraform service to authenticate against. Defaults to app.terraform.io (HCP Terraform). For Terraform Enterprise, specify your organization's hostname