Skip to content

terraform

The terraform command provides operations on Terraform workspaces that are configured in your clanker configuration file. It allows you to list and manage workspaces defined in ~/.clanker.yaml.

Usage

bash
clanker terraform <subcommand>

Subcommands

terraform list

List all Terraform workspaces configured in your clanker configuration file. The output includes each workspace's name, file system path, description, and whether it is the default workspace.

bash
clanker terraform list

Example output:

Available Terraform Workspaces (default: dev):

  dev (default)
    Path: /home/user/infrastructure/terraform
    Description: Development infrastructure

  stage
    Path: /home/user/infrastructure/terraform
    Description: Staging infrastructure

  prod
    Path: /home/user/infrastructure/terraform
    Description: Production infrastructure

Usage: clanker ask --terraform <workspace-name> "your infrastructure question"

Configuration

Terraform workspaces are defined in ~/.clanker.yaml under the terraform section:

yaml
terraform:
  default_workspace: dev
  workspaces:
    dev:
      path: /path/to/your/infrastructure
      description: Development infrastructure
    stage:
      path: /path/to/your/infrastructure
      description: Staging infrastructure
    prod:
      path: /path/to/your/infrastructure
      description: Production infrastructure

Each workspace entry requires:

  • path: The file system path to the Terraform project directory
  • description (optional): A human-readable description of the workspace

The default_workspace value determines which workspace is used when no workspace name is explicitly provided. It defaults to dev if not set.

Using Terraform with ask

Once workspaces are configured, you can query them using the ask command with the --terraform flag:

bash
clanker ask --terraform dev "what resources are defined in this workspace?"
clanker ask --terraform prod "show me the state of the VPC"

See Also