Quick start: your first infrastructure change

The scenario: the platform team manages the company’s DNS server. Application teams need DNS records for their apps.

In this guide, the platform team uses InfraBuffet to turn its DNS server into a self-service tool. Application teams can create and update DNS records for their apps without asking the platform team each time. The platform team sets the rules and stays in control of what teams can provision.

Before you start

You need:

  • A running InfraBuffet instance and a superuser account for the initial setup.
  • Docker.
  • Terraform installed at a known absolute path.
  • Network access to the Terraform registry for hashicorp/dns provider and to hub.docker.com

See Installation if you need an instance.

Start the DNS server

InfraBuffet needs infrastructure to manage. For this guide, we’ll run a DNS server in Docker to stand in for the platform team’s server. Later, application teams will use InfraBuffet to create and update records on it.

Create a dns directory with these files.

dns/named.conf:

include "/etc/bind/ibf-dns.key";

options {
    directory "/var/cache/bind";
    listen-on { any; };
    listen-on-v6 { none; };
    allow-query { any; };
    recursion no;
};

zone "example.com" {
    type primary;
    file "/etc/bind/zones/example.com.zone";
    journal "/var/cache/bind/example.com.jnl";
    allow-update { key "ibf-dns"; };
};

dns/zones/example.com.zone:

$TTL 300
@   IN SOA ns1.example.com. hostmaster.example.com. (
        2026102401 ; serial
        3600       ; refresh
        900        ; retry
        604800     ; expire
        300 )      ; minimum
    IN NS ns1.example.com.
ns1 IN A 127.0.0.1

Generate the TSIG key that InfraBuffet uses to sign its updates:

docker run --rm --entrypoint tsig-keygen internetsystemsconsortium/bind9:9.20 -a hmac-sha256 ibf-dns \
  > dns/ibf-dns.key

Start the server:

docker run -d --name owner-dns \
  -p 127.0.0.1:5353:53/udp -p 127.0.0.1:5353:53/tcp \
  -v "$PWD/dns/named.conf:/etc/bind/named.conf:ro" \
  -v "$PWD/dns/ibf-dns.key:/etc/bind/ibf-dns.key:ro" \
  -v "$PWD/dns/zones/example.com.zone:/etc/bind/zones/example.com.zone:ro" \
  internetsystemsconsortium/bind9:9.20

Port 5353 avoids conflicts with a resolver already listening on port 53. Check that the zone loads:

docker exec owner-dns dig @127.0.0.1 example.com SOA +short

Find the TSIG secret in the key file. You will paste it into the provider configuration later:

grep secret dns/ibf-dns.key

Create the owner and consumer teams

Sign in as the superuser and open Teams in the administration navigation.

  1. Choose Create team. Set Short name to platform and Full name to Platform team. Enable Allow creating infra, then create the team.
  2. Open the team’s detail page and use Add member to add your account.
  3. Create another team with Short name app and Full name Application team. Leave Allow creating infra disabled for this team.
  4. Add your account to app too, so the consumer scope appears in your home view.
  5. Open Users and choose Create user. Set Username to appuser, enter an email and password, and leave Superuser disabled.
  6. On the new user’s detail page, on the Teams card select the app team and choose Add.

Create the infrastructure

An infra object represents real infrastructure that its owner controls. An infra can be divided into scopes, each of which can be granted to a consumer team. The consumer team can then provision resources within its granted scope.

DNS infra contains app and dba scopes with two DNS record blocks each, linked to App team and DBA team.

Open Home → Provide, then choose Create Infra.

SettingValue
Owning teamplatform
Namedns
DescriptionAuthoritative DNS for application records
TypeTerraform
ExecutableThe absolute Terraform path from installation, such as:
/usr/local/bin/terraform
Deduplicator length3

Configure the DNS provider

In Terraform a provider is like a driver in the operating system - it lets the engine communicate with and manage a specific external service or system. A provider type identifies a Terraform provider and its version. A provider is a configured instance of provider type which points to a particular external service (DNS server with the address 1.2.3.4, AWS cloud in the region us-west-2 and with the secret key 1234ABCD, etc)

Open the infrastructure’s Provider Types tab and choose Create Provider Type.

SettingValue
Namedns
Linkhashicorp/dns
Version3.6.2
Secret overrides/update/*/key_secret

The * matches each update entry, so InfraBuffet treats its key_secret as a secret and masks it in responses.

Creating the type starts a schema synchronization job, a background task with a status and logs. Wait for it to complete. If it fails, open the linked job, check its logs, correct the executable or network issue, then choose Sync schema on the provider type’s page.

Open the infrastructure’s Providers tab and choose Create provider:

  • Name: dns-main.
  • Provider type: dns.
  • Provider values: set update to this YAML, with your secret in place of the placeholder:
- server: 127.0.0.1
  port: 5353
  key_name: ibf-dns.
  key_algorithm: hmac-sha256
  key_secret: "PASTE_THE_SECRET_HERE"

If InfraBuffet runs in a separate Docker container, 127.0.0.1 points to that container, not the DNS server. Use Docker Compose with a shared network and the DNS service name on port 53, or use a reachable host interface address such as 192.168.1.10 on port 5353.

Create a data source and add the Terraform module

InfraBuffet uses Terraform under the hood, so it needs a terraform module that defines how to create a DNS record. A data source is just a collection of files which can be stored locally or in git. We’ll use a Local data source this time.

Open Data Sources and choose Create data source:

  • Owning team: platform.
  • Name: dns-modules.
  • Type: Local.

Open the data source and choose Create file. Set Path to modules/dns-record/main.tf and paste this into Initial contents:

terraform {
  required_providers {
    dns = {
      source  = "hashicorp/dns"
      version = "3.6.2"
    }
  }
}

variable "fqdn" {
  type = string
}

variable "addresses" {
  type = list(string)
}

resource "dns_a_record_set" "record" {
  zone      = "example.com."
  name      = trimsuffix(var.fqdn, ".example.com")
  addresses = var.addresses
  ttl       = 300
}

The module fixes the zone to example.com. and removes .example.com from the supplied FQDN to get the record name. The template below restricts FQDNs to a single label under example.com, such as checkout.example.com.

Create the block template

A block template connects a module to the form consumers fill in and the validation rules for those inputs. Consumers can create DNS records from this template without writing Terraform.

Return to the infrastructure’s Block Templates tab and choose Create Block Template.

SettingValue
Namedns_record
IaC data sourcedns-modules
Module directorymodules/dns-record

Under Form fields, choose Add field and configure two fields:

NameTypeModeVerbose nameOther settings
fqdnStringRequiredFQDNSet the regular expression below.
addressesArrayRequiredIPv4 addressesItem type: String; set the item regular expression below.

The field names match the module’s two variables. Set Regular expression for fqdn to:

^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.example\.com$

This accepts third-level names such as checkout.example.com, but rejects example.com, checkout.apps.example.com, and names in other domains. Lowercase input keeps comparisons consistent.

For addresses, set the String item’s Regular expression to:

^[0-9]{1,3}(\.[0-9]{1,3}){3}$

This checks each array item for four dot-separated numbers. It is a simple IPv4 format check; it does not enforce that each number is at most 255.

Enable Use JavaScript validator to add some custom validation logic to the form. Choose dns-modules as Validator data source, then choose Create file under Validator file. Set New file path to validators/dns-name.js and paste this into Validator code:

function validate(block, context) {
  var answer = context.client.get("/api/infras/" + block.infra.id + "/blocks", {
    values__fqdn: block.values.fqdn,
    size: 2
  });
  if (!answer.ok) {
    return "Cannot check DNS name availability: " + answer.data.detail;
  }
  var taken = answer.data.items.some(function (other) {
    return other.id !== block.id;
  });
  if (taken) {
    return "This FQDN is already used in this infrastructure";
  }
}

Choose Save file to save the validator to the data source, then Create template to save the block template.

The validator searches all scopes in this infrastructure for the same fqdn. Omitting a scope filter makes the check span the whole infra. It skips the block being saved, so editing a block does not conflict with itself. It checks saved blocks only: it cannot see records created by hand, and concurrent saves can both pass the check.

Create and grant a scope

A scope is a workspace for blocks, with its own Terraform state tracking the resources it manages. Granting it to a team lets that team manage its blocks and apply changes, while the infra owner controls shared configuration.

Open the infrastructure’s Scopes tab and choose Create Scope.

SettingValue
Nameapps
Deduplicatorapp
Granted to teamapp
Default providerdns-main

The default provider supplies the dns provider to the module, so the form has no provider field.

Members of app can now manage blocks and run diff/apply in this scope. The platform team keeps ownership of the infrastructure, provider, template, and scope configuration.

Create a block

A block is one configured instance of a template. Here, it describes one DNS name and its IPv4 addresses.

To try the consumer experience, sign out and sign in as appuser. A superuser bypasses team permission checks, so you can also continue with your current account.

Open Home → Consume and choose apps under dns.

On the scope’s Blocks page, choose Add Block:

  • Name: checkout.
  • Block Template: dns_record.
  • FQDN: checkout.example.com.
  • IPv4 addresses: 10.20.0.5, 10.20.0.6.

Save the block. Its stored name is checkout.

Next, add a second block named checkout-legacy with FQDN checkout.example.com. Saving it fails with “This FQDN is already used in this infrastructure”. The same check applies to blocks in any other scope of this infra.

A new block has status New. Saving it records the intended configuration in InfraBuffet. It does not create a DNS record.

Review the diff

A diff is a Terraform plan showing how the saved blocks would change the actual DNS server. Choose Diff & apply with no blocks selected to calculate a diff for the entire scope. Wait for the job to finish.

The plan should propose one record: module.checkout.dns_a_record_set.record with name checkout, zone example.com., and both addresses. The summary should read Plan: 1 to add. Check that the plan contains only this creation.

Apply the reviewed changes

An apply executes the reviewed changes against the real infrastructure. Type apply into the confirmation field, then press Apply plan. Wait for the job to complete successfully.

After a successful apply, the block’s status becomes Applied. Confirm the record on the DNS server:

nslookup -port=5353 checkout.example.com 127.0.0.1
# OR
host -p 5353 checkout.example.com 127.0.0.1

The output lists 10.20.0.5 and 10.20.0.6, in either order. Run Diff & apply again: there should be nothing to apply.

Make another change

Edit the checkout block, remove 10.20.0.6 from IPv4 addresses, and save. The block becomes Changed. Calculate a new diff. The plan updates the existing record in place and removes one address. Apply it, then run the lookup command again. Only 10.20.0.5 remains.

This is the normal consumer loop: provision → diff → apply. Provisioning records the intended configuration; applying changes the DNS server.