Skip to content

terraform

This directory provides voice-control support for writing HashiCorp Configuration Language (HCL) and Terraform files using Talon. It implements context-specific commands, syntax keywords, and common code blocks tailored to Terraform development.

How It Works

The functionality is split into two files that work in tandem: a Python script defining the language semantics and actions, and a Talon file mapping spoken commands to those actions.

  • terraform.py defines the Terraform-specific vocabulary, operators, and programmatic actions.
  • terraform.talon activates when editing a Terraform file (code.language: terraform) and binds spoken commands to the actions defined in the Python file.

Key Features

Operators and Code Blocks

terraform.py configures standard programming operators for HCL (such as assignment =, lambda =>, and various mathematical/logical comparisons).

Additionally, terraform.talon imports general programming tags to provide standard functionalities like: * C-like block comments and line comments. * Boolean and null data types. * Standard assignment and mathematical operations.

Structure and Block Definitions

The files make it easy to quickly scaffold standard Terraform constructs:

  • Blocks: Spoken commands like state variable or state output invoke the code_terraform_module_block action to generate block headers.
  • Resources and Data Sources: Saying resource <text> or data source <text> formats the text input into SNAKE_CASE and inserts boilerplate structures (e.g., resource "aws_instance" "" or data "aws_ami" ""), placing the cursor in the right position to fill in the block details.
  • Common Properties: A curated list of common resource properties (such as for_each, depends_on, count, and prevent_destroy) can be typed instantly alongside assignment operators using the prop <property> command.
  • Types: Standard Terraform types (such as string, number, bool, list, map) can be typed quickly using the type <type> command.