Form fields reference

Form fields define what consumers see when they create or edit a block: text inputs, choices, numbers, and selectors for providers or other blocks. Configure them in the Form fields section when creating or editing a block template.

Choose Add field, set its Name, Type, and Mode, then fill in the options for that type. Use Add another field for more inputs and the arrow buttons to change their order in the block form.

The YAML examples below show the same settings using their schema names. You can configure the fields in the editor without writing YAML.

Common settings and modes

SettingMeaning
NameTerraform module input name, except for provider fields, which create provider bindings.
TypeString, Number, Boolean, Object, Array, Provider, Block, or Context.
ModeRequired, Optional, or Internal.
Verbose nameLabel shown to consumers instead of the field name.
DescriptionHelp text displayed below the field.

Names must be unique within the template. Start with an ASCII letter or _, then use letters, digits, or _. For example, use environment as the Name and Deployment environment as the Verbose name.

Choose a Mode according to who supplies the value:

  • Required: the consumer must supply a value. Empty text is rejected, but False and 0 are valid values. Required objects need at least one property, and required arrays need at least one item.
  • Optional: the consumer can leave the field unset.
  • Internal: the field appears locked in the block form. Use it for values supplied by a JavaScript validator.

Required fields are checked before the validator runs. If the validator computes a value, make that field Internal so the consumer does not have to supply it first.

String

Choose String for text. Consumers see a text input, or a selector if you configure Choices.

  • Default value prefills the field.

  • Choices restricts the value to a list. Choose Add choice for each allowed value; entries must be unique and nonempty. If you set a default, it must be one of these choices.

  • Regular expression checks the text against a pattern. Use either choices or a regular expression.

    For example, ^[a-z][a-z0-9-]*$ allows a lowercase name with digits and hyphens after the first letter. The ^ and $ anchors make the pattern check the whole value rather than a matching part.

  • Secret value hides saved text in ordinary views. See Secret values below.

Choices and regular expressions are unavailable for internal fields. Patterns use Go regular expression syntax.

For example, set Name to environment, Mode to Required, add development and production as Choices, and enter development as the Default value:

name: environment
type: string
mode: required
choices:
- development
- production
default: development

Number and boolean

Choose Number for numeric input. Set Minimum and Maximum to limit the allowed range; both limits are inclusive. A Default value must fall within that range. Internal numbers do not offer minimum or maximum settings.

By default, a number field accepts only integers, and its Default value, Minimum, and Maximum must be integers too. Enable Allow floating-point values to accept fractional numbers as well, such as 0.5.

For example, a required vlan field with Minimum 100 and Maximum 250 accepts integers from 100 through 250. A ratio field with Allow floating-point values enabled accepts both 1 and 0.75.

Choose Boolean for a True / False selector. Its Default value can be True, False, or No default. A required boolean accepts False as a supplied value.

- name: vlan
  type: number
  mode: required
  min: 100
  max: 250

- name: ratio
  type: number
  mode: optional
  float: true

- name: enabled
  type: boolean
  mode: optional
  default: true

Object

Choose Object to group related inputs under one module argument. Use Add subfield to define each input in the group. Consumers fill in those subfields together in the block form.

For example, a settings object can contain a required region string and an optional enabled boolean:

name: settings
type: object
mode: required
schema:
- name: region
  type: string
  mode: required
- name: enabled
  type: boolean
  mode: optional

The module receives them as one object, for example:

settings:
  region: eu-west-1
  enabled: true

Every object needs at least one subfield. Subfields can be String, Number, or Boolean, with Required or Optional mode. They support labels, descriptions, defaults, and the constraints for their type. They cannot be internal or secret, and cannot contain further objects, arrays, providers, blocks, or context fields.

Array

Choose Array for a list of values. Set Item type to String, Number, Boolean, or Object. Consumers use Add item to build the list and can remove or reorder items.

For string items, configure Choices or a Regular expression; for number items, configure Minimum, Maximum, and Allow floating-point values as needed. Individual items have no name, mode, or default value.

For Object items, use Add subfield to define the inputs repeated for each item. The same subfield rules as for objects apply. For example, this lets consumers add multiple instances, each with a name and enabled setting:

name: instances
type: array
mode: optional
item_schema:
  type: object
  schema:
  - name: name
    type: string
    mode: required
  - name: enabled
    type: boolean
    mode: optional

A required array needs at least one item. An optional array can be empty. The module receives the items in their listed order.

Provider

Choose Provider when consumers need to select a configured provider, such as the account or region where resources will be created.

  • Provider type: select the type from this infrastructure that consumers may choose from.
  • Provider alias: enter the alias expected by the Terraform module, such as west. Leave it empty for an unaliased provider configuration. Aliases follow the same naming rules as field names.

For example, create a field named target_provider, select your AWS provider type, and enter west as the Provider alias. When creating a block, the consumer selects a configured AWS provider from the same infrastructure.

This creates a Terraform provider mapping rather than passing target_provider as a module variable. The module declares the alias and uses it to read from the selected provider:

terraform {
  required_providers {
    aws = {
      source                = "hashicorp/aws"
      configuration_aliases = [aws.west]
    }
  }
}

data "aws_region" "selected" {
  provider = aws.west
}

Provider fields have no default value. See multiple providers for a complete module example.

Block

Choose Block when a module input needs an output from another block, such as a network ID.

  • Block template: select the template of the blocks consumers may choose from.
  • Block accessor: enter the output name, followed by any nested attributes separated by dots.

For example, create a field named network_id, select your network template, and set Block accessor to network.id. Consumers then select a network block from the same scope. InfraBuffet passes a reference to that block’s output to the module, and Terraform orders the dependency.

The receiving module declares network_id as an ordinary variable and uses the selected output value:

variable "network_id" {
  type = string
}

resource "terraform_data" "server" {
  input = { net_id = var.network_id }
}

An accessor can name an output directly, such as id, or a nested attribute, such as network.id. Each segment follows the field naming rules. Brackets, numeric indexes, empty segments, and leading or trailing dots are not allowed.

Block fields have no default value. Dependencies between templates and blocks must not form a cycle. See block dependencies for a complete example.

Context

Choose Context to pass information about the block to the module automatically. Consumers do not see this field in the block form and do not enter a value.

The editor suggests Name ctx and fixes Mode to Internal. You can change the name to match your module input. A template can have only one context field; it has no label or description settings.

name: ctx
type: context
mode: internal

InfraBuffet passes an object with two attributes:

  • block_name: the stored name of the block.
  • deduplicator: the deduplicator of the block’s scope.

Module authors can combine these attributes in resource names to avoid collisions between scopes. See deduplicators for a DNS module example.

For a field named ctx, the module declares:

variable "ctx" {
  type = object({
    block_name   = string
    deduplicator = string
  })
}

Secret values

Enable Secret value on a string field for sensitive text. In the block form, the field has a Secret badge and a masked input. Once you type a value, an eye button appears; press and hold it to see the text you entered. Saved secrets are not loaded back into the form.

When editing a block, leave a secret input blank to keep its existing value, or enter new text to replace it. For an optional secret, choose Clear value to remove it. Choose Keep existing value to undo that choice before saving.

Secrets are passed to Terraform in plaintext. Don’t forget to mark variables in a module as sensitive