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.
| Property | Type | Description | Mandatory |
|---|
name | string | Unique identifier for the sync instance. | Yes |
store | SyncStore | Configuration for the optional storage mechanism. | No |
source | SyncAdapter | Configuration for the source adapter. | Yes |
destination | SyncAdapter | Configuration for the destination adapter. | Yes |
order | List of strings | Specifies the order in which objects should be synchronized. | Yes |
schema_mapping | List of SchemaMappingModel | Defines how data is mapped from source to destination. | Yes |
diffsync_flags | List of DiffSyncFlags | Instruct Infrahub Sync how to handle some specific situation without changing the data | No |
Sync store
Optional configuration for a storage mechanism used for stateful synchronization.
| Property | Type | Description | Mandatory |
|---|
| type | string | Type of the store (for example redis). | Yes |
| settings | Dictionary | Connection details and other settings for the store. | No |
Source and Destination
Configuration for source and destination adapters.
| Property | Type | Description | Mandatory |
|---|
| name | string | Identifier for the adapter. | Yes |
| settings | Dictionary | Adapter-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
| Property | Type | Description | Mandatory |
|---|
| name | string | Infrahub model name to be mapped. | Yes |
| mapping | string | The source's schema mapping (API) path. | Yes |
| identifiers | List of strings | Fields used to uniquely identify an object. | Yes |
| fields | List of SchemaMappingField | Describes individual field mappings or transformations. | Yes |
| filters | List of SchemaMappingFilter | Filters you want to apply during the sync. | No |
| transforms | List of SchemaMappingTransform | Transforms you want to apply during the sync. | No |
Mapping field
| Property | Type | Description | Mandatory |
|---|
| name | string | Name of the field. | Yes |
| mapping | string | How the field is mapped from source to destination. | No |
| static | Any | A static value to assign to the field, used if mapping is not provided. | No |
| reference | string | Reference to another object in the configuration, used if direct mapping is not applicable. | No |
Mapping filters
| Property | Type | Description | Mandatory |
|---|
| field | string | Name of the source field to filter on. | Yes |
| operation | string | Which filters will be applied on the field. Available operations are described below. | No |
| value | string | The expected value linked to the operation. | Yes except for both is_empty and is_not_empty operation |
Available filter operations
| Operation | Description |
|---|
== | 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). |
in | Checks if the field value is within the provided list or string. |
not in | Checks if the field value is not within the provided list or string. |
contains | Checks if the provided value is contained within the field value. |
not contains | Checks if the provided value is not contained within the field value. |
is_empty | Checks if the field value is None or empty. Does not require a value argument. |
is_not_empty | Checks if the field value is not None and not empty. Does not require a value argument. |
regex | Checks if the field value matches the provided regular expression pattern. |
is_ip_within | Checks if the field value (an IP address) is within the provided IP range using netutils. |
| Property | Type | Description | Mandatory |
|---|
| field | string | Name of the target field. | Yes |
| expression | string | A Jinja filter compatible expression. | Yes |