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
- [yaml] set defaults
- [yaml] override specific
- [yaml] combined
- [toml] combined example
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
app: docs-example
provider: aws
path: .
out_dir: compiled
execution_units:
api:
type: lambda
pulumi_params:
timeout: 240
users:
type: lambda
pulumi_params:
timeout: 900
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
execution_units:
api:
type: lambda
pulumi_params:
timeout: 240
users:
type: lambda
pulumi_params:
timeout: 900
app = 'docs-example'
provider = 'aws'
path = '.'
out_dir = 'compiled'
[defaults]
[defaults.execution_unit]
type = 'lambda'
[defaults.execution_unit.pulumi_params_by_type.lambda]
memorySize = 1024
[defaults.persist.orm]
type = 'rds_postgres'
[defaults.persist.orm.pulumi_params_by_type.rds_postgres]
instanceClass = 'db.t4g.medium'
[execution_units]
[execution_units.microsrv-api]
type = 'lambda'
[execution_units.microsrv-api.pulumi_params]
timeout = 240
[execution_units.microsrv-users]
type = 'lambda'
[execution_units.microsrv-users.pulumi_params]
timeout = 900