Appendix A

The standard library

Every plugin below ships in one npm package carrying "spellcraft": true. Install it and SpellCraft finds it through your dependencies — there is nothing to register, and nothing to install per plugin.

npm install --save @c6fc/spellcraft-plugins

9 nodes in @c6fc/spellcraft-plugins@1.1.0 · generated from source on 2026-09-13

AWS

Credentials, the SDK reachable from Jsonnet, an S3 state backend, and factories for buckets and Lambda functions.

  • aws.auth AWS credentials, role chaining and profile handling for SpellCraft, with the AWS SDK reachable directly from Jsonnet.
  • aws.terraform S3 state backend, remote state, artifacts and provider aliases for SpellCraft.
  • aws.terraform.s3 Secure-by-default S3 buckets for SpellCraft, in one line of Jsonnet.
  • aws.terraform.lambda Node.js Lambda functions for SpellCraft, packaging, IAM and log retention included.
Read the reference →
manifest.jsonnet
local plugins = import "@c6fc/spellcraft-plugins/module.libsonnet";
local aws = plugins.aws.terraform;
local s3 = plugins.aws.terraform.s3;

{
  // Creates the state bucket if it is missing, and returns the backend block.
  "backend.tf.json": aws.bootstrap("my-project"),

  // One aliased provider per region the account can see, plus a default.
  "providers.tf.json": { provider: aws.providerAliases("us-east-1") },

  // KMS-encrypted, public access blocked, TLS 1.2 enforced.
  "artifacts.tf.json": s3.bucket("artifacts", "us-west-2"),
}

GCP

Application Default Credentials, the googleapis client from Jsonnet, a GCS state backend, and whole organization trees from one nested description.

  • gcp.auth GCP credentials and the googleapis client for SpellCraft, reachable directly from Jsonnet.
  • gcp.terraform GCS state backend, remote state, artifacts, provider aliases and whole organization trees for SpellCraft.
Read the reference →
manifest.jsonnet
local gcp = (import "@c6fc/spellcraft-plugins/module.libsonnet").gcp.terraform;

{
  // Creates the state bucket if it is missing, and returns the backend block.
  "backend.tf.json": gcp.bootstrap("my-project"),

  // One aliased provider per region matching the filter, plus a default.
  "providers.tf.json": { provider: gcp.providerAliases("us-west2", {}, "us-") },

  // Folders, projects, service accounts, IAM and API activation, ordered.
  "org.tf.json": gcp.googleOrgProject("platform", "us-west2", {
    type: "folder",
    name: "engineering",
    children: [{ type: "project", name: "sandbox" }],
  }),
}

Terraform

The provider-neutral lifecycle node — rendering, applying, destroying, the events other plugins hang work on, and the binary it manages.

  • terraform Provider-neutral Terraform lifecycle for SpellCraft: renders a manifest, then runs `terraform apply` on the result.
Read the reference →
manifest.jsonnet
{
  "main.tf.json": {
    terraform: { required_version: ">= 1.2" },
    resource: {
      aws_s3_bucket: {
        artifacts: { bucket_prefix: "artifacts-" },
      },
    },
  },
}

Utilities

Provider-agnostic Jsonnet — a tree walker for turning nested structures into flat configuration, and a deep merge that is not a performance trap.

  • utils.tree Turn a nested structure into flat configuration, in one pass, for SpellCraft.
  • utils.merge Deep-merging for SpellCraft, without the performance trap in `std.mergePatch`.
Read the reference →
manifest.jsonnet
local tree = (import "@c6fc/spellcraft-plugins/module.libsonnet").utils.tree;

{
  "org.tf.json": tree.walk({
    name: "engineering",
    children: [
      { name: "production", children: [{ name: "api" }] },
      { name: "staging" },
    ],
  }, {
    inherited: "organizations/123456789",

    // Names accumulate: acme_engineering, acme_engineering_production, ...
    parentName: "acme",
    name(ctx):: "%s_%s" % [ctx.parentName, ctx.body.name],

    // What this node's children inherit — a reference to what it just declared.
    handoff(ctx):: "folders/${google_folder.%s.folder_id}" % ctx.name,

    node(ctx):: {
      resource: { google_folder: { [ctx.name]: {
        display_name: ctx.body.name,
        parent: ctx.inherited,
      } } },
    },
  }),
}

Write your own

The generator scaffolds a working plugin whose tests pass on the first run. Delete the two example functions and start.

npm init spellcraft-module Read the plugin contract →