Skip to main content

Configuration

A configuration file can be passed into Klotho via the --config CLI flag.

Klotho configuration

  • Any compilation-affecting CLI flags (eg: --app, --outDir, --provider) as well as the input (source files) path.
  • An annotation's (instance of a capability) type, which represents the provider-specific implementation for that capability.
    • For more information on which types are supported, see the relevant capability's documentation for your provider.

IaC configuration

  • Overrides for infra-as-code parameters. These are currently written as-is so if there's any type or key errors, that will similarly be propagated.
FAQ: Can I write my IaC overrides in the IaC's format?

Short answer: not at the moment except for as modifying the output code

For now, we believe it makes sense to specify the type and the IaC configuration side-by-side to ensure the maintainer of these has the full context. Additionally, we need the ability to merge our internal defaults with specified overrides which is more complex for non-configuration languages. There's a bunch of other considerations that we'd need to resolve to support them, so for now we're defaulting to the simplest & safest option.

How to write a configuration

On every compile, we output a 'rendered' (defaults and overrides applied) version of the config file at $outDir/klotho.$format (format defaults to yaml if no input config file given, but can be specified via --cfg-format as "json", "toml" or "yaml").

You can copy out this file and rename it as desired and store it in your VCS to give to klotho on subsequent compilations.

tip

You're encouraged to remove configuration you don't explicitly need. This allows your compilations to track the latest defaults that we offer and to keep the file as minimal & digestable as possible.

Example files

This overrides the default lambda `memorySize` to 1024 and RDS instance class to `db.t4g.medium` in addition to the CLI parameters (for convenience).
app: docs-example
provider: aws
path: .
out_dir: compiled
defaults:
execution_unit:
type: lambda
pulumi_params_by_type:
lambda:
memorySize: 1024
persist:
orm:
pulumi_params_by_type:
rds_postgres:
instanceClass: db.t4g.medium