Skip to main content

Sync configuration file

The configuration file allows you to define the resources needs for the sync. The file should be formatted as a Yaml file, have the filename config.yml. During the generation phase, the Sync adapters, and models will be generated in the same folder.

The following settings can be defined:

Configuration fields

Describes the overall synchronization configuration.

PropertyTypeDescriptionMandatory
namestringUnique identifier for the sync instance.Yes
storeSyncStoreConfiguration for the optional storage mechanism.No
sourceSyncAdapterConfiguration for the source adapter.Yes
destinationSyncAdapterConfiguration for the destination adapter.Yes
orderList of stringsOrder in which objects should be synchronized. Optional — when omitted, infrahub-sync auto-computes tiers from schema_mapping.No
schema_mappingList of SchemaMappingModelDefines how data is mapped from source to destination.Yes
diffsync_flagsList of DiffSyncFlagsInstruct Infrahub Sync how to handle some specific situation without changing the dataNo

Auto-tiered execution

order: is now optional. When it is omitted, infrahub-sync derives a write-order graph from the reference: entries in each schema_mapping field and groups kinds into tiers:

  • Tier 0: kinds with no outgoing references.
  • Tier N: kinds whose references all live in tiers 0..N-1.

The flattened tier order replaces the manual order: list. Tiers and any optional edges dropped to break cycles are logged at INFO level when diff or sync runs.

infrahub-sync sync runs with --parallel on by default: the engine narrows the destination's top_level to one tier at a time so no tier starts before the previous tier's writes have completed. Pass --no-parallel to disable the tier boundary and fall back to the legacy single-pass code path.

If you must override the computed order (because it doesn't match an adapter quirk), keep the order: list — it always wins, and --parallel will warn and fall back to serial when an explicit order is set.

Sync store

Optional configuration for a storage mechanism used for stateful synchronization.

PropertyTypeDescriptionMandatory
typestringType of the store (for example redis).Yes
settingsDictionaryConnection details and other settings for the store.No

Source and Destination

Configuration for source and destination adapters.

PropertyTypeDescriptionMandatory
namestringIdentifier for the adapter.Yes
settingsDictionaryAdapter-specific settings like url and token. If not provided, values will be loaded from environment variables.No

Schema Mapping

Defines the mappings from source to destination schemas.

Mapping models

PropertyTypeDescriptionMandatory
namestringInfrahub model name to be mapped.Yes
mappingstringThe source's schema mapping (API) path.Yes
identifiersList of stringsFields used to uniquely identify an object.Yes
fieldsList of SchemaMappingFieldDescribes individual field mappings or transformations.Yes
filtersList of SchemaMappingFilterFilters you want to apply during the sync.No
transformsList of SchemaMappingTransformTransforms you want to apply during the sync.No
Mapping field
PropertyTypeDescriptionMandatory
namestringName of the field.Yes
mappingstringHow the field is mapped from source to destination.No
staticAnyA static value to assign to the field, used if mapping is not provided.No
referencestringReference to another object in the configuration, used if direct mapping is not applicable.No
Mapping filters
PropertyTypeDescriptionMandatory
fieldstringName of the source field to filter on.Yes
operationstringWhich filters will be applied on the field. Available operations are described below.No
valuestringThe expected value linked to the operation.Yes except for both is_empty and is_not_empty operation
Available filter operations
OperationDescription
==Checks if the field value is equal to the provided value.
!=Checks if the field value is not equal to the provided value.
>Checks if the field value is greater than the provided value (after converting both to integers if necessary).
<Checks if the field value is less than the provided value (after converting both to integers if necessary).
>=Checks if the field value is greater than or equal to the provided value (after converting both to integers if necessary).
<=Checks if the field value is less than or equal to the provided value (after converting both to integers if necessary).
inChecks if the field value is within the provided list or string.
not inChecks if the field value is not within the provided list or string.
containsChecks if the provided value is contained within the field value.
not containsChecks if the provided value is not contained within the field value.
is_emptyChecks if the field value is None or empty. Does not require a value argument.
is_not_emptyChecks if the field value is not None and not empty. Does not require a value argument.
regexChecks if the field value matches the provided regular expression pattern.
is_ip_withinChecks if the field value (an IP address) is within the provided IP range using netutils.
Mapping transforms
PropertyTypeDescriptionMandatory
fieldstringName of the target field.Yes
expressionstringA Jinja filter compatible expression.Yes