Skip to main content
  • A Fjall application created with fjall create app (or fjall apps create), so an infrastructure.ts file exists.
  • The resource you want to change is already declared. Run fjall list -a <app> to see what the application declares.
  • Node 22.3 or later.
fjall modify edits source code. It makes no AWS calls and changes nothing that is already deployed. Run fjall deploy afterwards to apply the change to AWS.

Modify a resource

fjall modify changes the properties of an existing resource in an application’s infrastructure.ts. It edits the source file in place through the codemod engine, the same AST-based editor behind fjall add and fjall remove.
Pass each property to change as a --<property> <value> pair. Properties you leave out keep their current values, so a modify merges into the existing declaration rather than replacing it.

Examples

Change a database instance type:
Update a Lambda function’s memory:
Set several properties at once:

Resource types

Valid <type> values: database, storage, compute, messaging, cdn, network, pattern, vpc-peer, vpc-peer-accepter, cross-plan-connection, organisation, buildkite. --name is the name the resource was added under. Names start with a letter and contain letters and digits only, so PascalCase is the convention rather than a rule. An unknown name is refused. In a terminal the error also lists the names the file does declare; the non-interactive and agent lanes report only the missing name, so run fjall list --app <name> to see what is declared.

Property flags

Any flag modify does not register (see Options) is treated as a resource property. Flag names are the camelCase keys of the resource schema, so --instanceType is correct and --instance-type is not. Four parsing rules apply:
  1. Each flag consumes the next token as its value. A trailing flag with no value is rejected.
  2. A flag immediately followed by another --flag is rejected. There are no value-less booleans, so pass an explicit value such as --multiAz true.
  3. Duplicate flags are rejected so typos surface instead of being silently overwritten.
  4. A value starting with { or [ must parse as JSON. A malformed payload is an error, never a string literal.
Unknown property names are refused with the nearest match suggested, so a mistyped --maxazs is reported against maxAzs rather than written into the construct.

Nested properties

From fjall 37 a flag may name a nested property with a dotted path. The edit lands on that one leaf and leaves its siblings as they are, where a plain flag replaces the whole value. Turning versioning on for a Payload site’s media bucket is one flag:
Every segment is checked against the resource schema, so an unknown segment at any level is refused naming that level’s keys, and a segment that lands on a property that is not an object (--type.x) is refused too. A pattern is judged against its own type’s configuration: --storage.media.versioned on a static site is refused as not a pattern property, because a static site’s configuration has no storage block, and --type cannot change a pattern’s type, since the construct id and configuration belong to the type it was added as; remove it and add a pattern of the new type. Passing a path beside its own prefix in one command (--storage with --storage.media.versioned) is refused before anything is written, because which of the two survived would depend on the order they were applied. A file that writes the parent as something other than an object literal — a spread, a variable, a computed key — is refused with the cure: pass the parent as one whole value.

Presets and tiers

--preset and --tier are selectors, not properties. They expand into the same explicit properties you could have typed by hand, which makes them the short path to re-applying a preset to a resource you already declared. Three rules govern them:
  • The two cannot be combined. Use --preset for storage and --tier for database and network.
  • --tier on a database also needs --type, because a tier describes each database type differently.
  • Explicit property flags win over the preset, so a preset stays a starting point rather than something to avoid when you want to override one key.
--tier is refused on fjall modify compute. A compute tier preset is keyed by compute type and carries scaffold placeholders only fjall apps create --tier fills in.

What happens

  1. Resolves the infrastructure.ts path for the application you pass to --app.
  2. In an interactive terminal, shows a confirmation screen naming the target resource and file path. It defaults to No.
  3. Parses the file with the codemod engine and locates the resource named by --name.
  4. Merges your --<property> <value> pairs into the declaration, writes the updated file, refreshes the sibling infrastructure.ts.bak, and records a timestamped snapshot under .fjall/history/.
  5. In the --non-interactive and --agent lanes, typechecks the edited file and reports the verdict. The interactive confirmation lane stops after the write.
No step contacts AWS.

Confirmation

--non-interactive, --agent, and any non-TTY shell such as a pipe or a CI job skip the confirmation and write straight through. modify registers no --yes flag, so those three are the only ways to bypass the prompt.

Typecheck verdict

The --non-interactive and --agent lanes typecheck the edited application after a successful write, unless you pass --no-verify. The interactive confirmation lane runs no post-write typecheck, so it prints no verdict and --no-verify changes nothing there. Check the file yourself with fjall validate --app <name> --deep.
A failed typecheck exits non-zero, and the edit is already on disk with its backup. Fix the errors in infrastructure.ts, or revert with fjall undo --app <name>.

Options

These are the flags modify registers. Everything else is a property flag.

Agent options

For AI-agent and scripted use, modify also accepts the standard agent flags. Agent mode applies the change in one step and returns the resource, file path, lines changed, and typecheck verdict.

After modifying a resource

  1. Review the modified infrastructure.ts. The --non-interactive and --agent lanes typecheck it for you unless you passed --no-verify. After an interactive run, typecheck it with fjall validate --app api --deep.
  2. Confirm the change: fjall list --app api.
  3. Deploy to apply the change to AWS: fjall deploy api.

Next Steps

fjall deploy

Apply the changed infrastructure to AWS.

fjall add

Add a new resource to an application’s infrastructure.ts.

fjall remove

Remove a resource from an application’s infrastructure.ts.

fjall undo

Revert the last codemod from the sibling .bak backup.

fjall list

List the resources an application declares.

Add resources guide

Walk through adding resources to an application end to end.