---
name: "glab-opentofu-init"
section: "1"
platform: "linux"
package: "glab"
version: "1.126.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/glab-opentofu-init"
---

# glab-opentofu-init(1)

Initialize OpenTofu or Terraform.

## NAME

glab-opentofu-init - Initialize OpenTofu or Terraform.

## SYNOPSIS

**glab opentofu init  \[flags\]**

## DESCRIPTION

Configures the GitLab HTTP backend for OpenTofu or Terraform state and runs **tofu init**. You must run this command from a GitLab project repository.

If glab is installed as a snap, it cannot run OpenTofu or Terraform binaries installed on the host or by other snaps. Place the binary in your home directory and pass its path with **--binary**.

## OPTIONS

**-b**, **--binary**="tofu"\
 	Name or path of the OpenTofu or Terraform binary to use for the initialization.

**-d**, **--directory**="."\
 	Directory of the OpenTofu or Terraform project to initialize.

## OPTIONS INHERITED FROM PARENT COMMANDS

**-h**, **--help**\[=false\]\
 	Show help for this command.

**-R**, **--repo**=""\
 	Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted.

## EXAMPLE

```
# Initialize state with name production in working directory
glab opentofu init production
# Initialize state with name production in infra/ directory
glab opentofu init production -d infra/
# Initialize state with name production with Terraform
glab opentofu init production -b terraform
# Initialize state with name production with reconfiguring state
glab opentofu init production -- -reconfigure
```

## SEE ALSO

**[glab-opentofu(1)](/glab-opentofu/1.md)**
