Fortinet FortiGate ApplyConfig

Fortinet FortiGate ApplyConfig

Certified
Enterprise Edition

Apply intended CMDB entries to a FortiGate

Computes the same difference as DiffConfig and applies only that delta: a POST for each new entry and a PUT with the changed fields for each entry that differs. With prune: true, entries of the listed tables that are not in tables are deleted, referencing tables first (policies, then groups, then objects). checkMode: true returns the diff and writes nothing.

FortiOS applies each call immediately: there is no candidate configuration and no commit. The task stops at the first rejected call, never reverts, and names the entries already applied in the error. Take a backup with GetConfig first: RestoreConfig is the way back. A FortiGate managed by FortiManager goes out of sync when changed this way: use policy packages there. Needs a direct connection and a read-write API profile.

Secret fields (type: password in the FortiOS schema) are masked as ****** in the diff and excluded from drift detection, because the device only returns them encrypted. They are still sent with the secret value you gave when an entry is created, or updated because other fields differ. A change to a secret alone is not detected, so it is never applied on its own.

yaml
type: io.kestra.plugin.ee.fortinet.fortigate.ApplyConfig

Back up, then apply address objects

yaml
id: fortigate_apply_config
namespace: company.network

tasks:
  - id: backup
    type: io.kestra.plugin.ee.fortinet.fortigate.GetConfig
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"

  - id: apply
    type: io.kestra.plugin.ee.fortinet.fortigate.ApplyConfig
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    tables:
      firewall/address:
        - name: web-servers
          type: ipmask
          subnet: 10.20.0.0 255.255.255.0
Installation

This Enterprise plugin requires an Enterprise image and access to the plugin registry. Install it with the following command:

kestractl plugins get io.kestra.plugin.ee:plugin-ee-fortinet --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

Properties

Tables

Intended entries per CMDB table: a map whose key is the table path (firewall/address, firewall/policy, ...) and whose value is the list of entries. The key of each entry is the table's own key (name, policyid, ...), read from the FortiOS schema, not guessed. Only the fields you give are compared: fields you leave out are ignored, and a missing value counts as the table default. Entries of a listed table that are not in the list are reported for deletion. Policy order is not compared.

API token

Key of a REST API administrator (execute api-user generate-key). It is sent in the Authorization: Bearer header only, never in the URL. Use {{ secret('FORTIGATE_API_TOKEN') }}. Set a trusthost on the API administrator to the egress range of your worker group. Configuration backup, restore and firmware upgrade need the super_admin profile, the other tasks work with a read profile (read-write for the tasks that change configuration).

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

CA certificate

PEM encoded CA certificate(s) used to validate the FortiGate certificate. When set, only this CA is trusted. When empty, the JVM trust store is used.

Check mode

Return the diff and write nothing. Defaults to false.

Connect timeout

Maximum time to open the connection. Must be greater than zero. Defaults to 10 seconds.

Managed device

Name of the FortiGate in FortiManager. Only used with fortiManager.

FortiManager proxy

Reach the FortiGate through a FortiManager when the worker can only connect to the manager. Reads only: the call goes through exec /sys/proxy/json. Tasks that write (ApplyConfig, RestoreConfig, Reload) and GetConfig backups need a direct connection: on a managed FortiGate, change configuration with policy packages. Needs device.

Definitions
host*string

FortiManager host

Host name or IP address of the FortiManager management interface.

adomstring

ADOM

Administrative domain that holds the managed device. Defaults to root.

apiKeystring

API key

REST API key of a FortiManager API user (FortiManager 7.2.2 and later), sent in the Authorization header. Use {{ secret('FORTIMANAGER_API_KEY') }}.

caCertificatestring

CA certificate

PEM encoded CA certificate(s) used to validate the FortiManager certificate. When empty, the JVM trust store is used.

connectTimeoutstring

Connect timeout

Maximum time to open the connection. Must be greater than zero. Defaults to 10 seconds.

insecureSkipVerifybooleanstring

Skip TLS verification

Disables certificate and host name validation. Only for labs with self-signed certificates. Defaults to false.

passwordstring

Password

Administrator password. Use {{ secret('FORTIMANAGER_PASSWORD') }}.

portintegerstring

FortiManager port

HTTPS port. Defaults to 443.

requestTimeoutstring

Request timeout

Maximum time to wait for one answer. Must be greater than zero. Defaults to 60 seconds.

usernamestring

Username

Administrator name, used with password when no apiKey is set.

FortiGate host

Host name or IP address of the FortiGate management interface. Required unless fortiManager and device are set.

Skip TLS verification

Disables certificate and host name validation. Only for labs with self-signed certificates. Defaults to false.

FortiGate port

HTTPS port of the management interface. Defaults to 443.

Prune

Delete the entries of the listed tables that are not in tables. Defaults to false.

Request timeout

Maximum time to wait for one answer. Must be greater than zero. Defaults to 60 seconds.

VDOM

VDOM the call applies to. Defaults to root. Global tables (system/...) ignore it.

Changed

True when entries were created, updated or deleted. In check mode: when they would be.

SubTypestring

Created

Entries created, as <table>/<key>.

SubTypestring

Deleted

Entries deleted, as <table>/<key>. Always empty without prune.

Formaturi

Diff

Internal storage URI of the diff file. Only set when something differs.

SubTypestring

Updated

Entries updated, as <table>/<key>.