Fortinet FortiManager policies Upsert
Certified
Enterprise Edition
Create or update a firewall policy in a policy package
Fortinet FortiManager policies Upsert
Create or update a firewall policy in a policy package
Idempotent: the policy is found by policyid when entry has one, otherwise by name. It is created when it does not exist (FortiManager assigns the policyid when none is given) and updated only when a field you give differs. Fields you do not give are left alone. The position of a policy is handled by policies.Move.
The change lands in the policy package: run InstallPackage to push it to the devices.
type: io.kestra.plugin.ee.fortinet.fortimanager.policies.UpsertExamples
Make sure an allow policy exists
id: fortimanager_upsert_policy
namespace: company.network
tasks:
- id: upsert_policy
type: io.kestra.plugin.ee.fortinet.fortimanager.policies.Upsert
host: fmg.example.com
apiKey: "{{ secret('FORTIMANAGER_API_KEY') }}"
adom: root
policyPackage: branch-policy
entry:
name: web-to-internet
srcintf: [lan]
dstintf: [wan]
srcaddr: [web-servers]
dstaddr: [all]
service: [HTTPS]
action: accept
schedule: [always]
logtraffic: all
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
entry *object
Entry
FortiManager JSON entry of the policy. Needs a policyid or a name to find an existing policy.
host *string
FortiManager host
Host name or IP address of the FortiManager management interface.
policyPackage *string
Policy package
Name of the policy package, or folder/package when it sits in a folder (see ListPackages).
adom string
ADOM
Administrative domain to work in. Defaults to root.
apiKey string
API key
REST API key of a FortiManager API user (FortiManager 7.2.2 and later), sent in the Authorization header and never in the URL. Use {{ secret('FORTIMANAGER_API_KEY') }}. Set either apiKey or username and password.
assets
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.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset 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.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150caCertificate string
CA certificate
PEM encoded CA certificate(s) used to validate the FortiManager certificate. When empty, the JVM trust store is used.
checkMode booleanstring
Check mode
When true, reads the current state and reports what would change without writing anything. Defaults to false.
connectTimeout string
Connect timeout
Maximum time to open the connection. Must be greater than zero. Defaults to 10 seconds.
insecureSkipVerify booleanstring
Skip TLS verification
Disables certificate and host name validation. Only for labs with self-signed certificates. Defaults to false.
lockTimeout string
Lock timeout
Maximum time to wait for the ADOM lock when waitForLock is true. Defaults to 1 minute.
password string
Password
Administrator password. Use {{ secret('FORTIMANAGER_PASSWORD') }}. Never logged nor returned in outputs.
port integerstring
FortiManager port
HTTPS port. Defaults to 443.
requestTimeout string
Request timeout
Maximum time to wait for one answer. Must be greater than zero. Defaults to 60 seconds. Long jobs are polled by task ID instead.
username string
Username
Administrator name, used with password when no apiKey is set. The plugin logs in once per task run and always logs out at the end. Accounts with multi-factor authentication cannot log in this way: use an apiKey.
waitForLock booleanstring
Wait for lock
When another administrator holds the ADOM lock, retry until lockTimeout instead of failing at once. Defaults to false.
workspace string
AUTOLOCK_ONLYNONEWorkspace handling
How the ADOM workspace lock is handled around the write. AUTO (default) detects the workspace mode: when it is on, the ADOM is locked, the change committed and the ADOM unlocked in a finally block. LOCK_ONLY locks and unlocks without committing, so the change stays pending for a later commit. NONE never locks. ADOMs in workflow mode (approval required) are refused with AUTO: submitting workflow sessions is not supported.
Outputs
action string
Action
CREATE, UPDATE or NONE.
changed boolean
Changed
True when the policy was created or updated. In check mode: when it would be.
policyId integer
Policy ID
policyid of the policy. Not set when a new policy would be created in check mode without an explicit policyid.