Skip to main content

atmos terraform login

Use this command to authenticate with Terraform Cloud or Terraform Enterprise for an Atmos component in a stack.

Terraform Only

This command is specific to Terraform and is not available in OpenTofu. OpenTofu removed Terraform Cloud integration features.

atmos terraform login --help

Usage

Execute the terraform login command like this:

atmos terraform login <component> [hostname] -s <stack> [options]

This command retrieves an API token from Terraform Cloud or Terraform Enterprise and saves it locally for use with other commands that require authentication.

Atmos Behavior

This is a pure passthrough command. Atmos does not perform automatic initialization or workspace management for terraform login. The command is executed directly to manage Terraform Cloud credentials.

Examples

Login to Terraform Cloud

# Login to app.terraform.io (default)
atmos terraform login vpc -s dev

Login to Terraform Enterprise

# Login to a specific host
atmos terraform login vpc -s dev terraform.company.com

Arguments

component (required)

Atmos component name.

hostname (optional)

Optional hostname of Terraform Cloud or Terraform Enterprise (e.g., terraform.company.com). If not provided, defaults to app.terraform.io.

Flags

--stack / -s (required)

Atmos stack name where the component is defined.

--skip-init (optional)

Skip running terraform init before executing the command.

atmos terraform login vpc -s dev --skip-init
--dry-run (optional)

Show what would be executed without actually running the command.

atmos terraform login vpc -s dev --dry-run

Native Terraform Flags

This command supports native terraform login flags, such as an optional hostname argument. The token is saved in the credentials file.