When installing a policy_package with fortimgr_install, the "fortigate_name" parameter specifying the device on which to install the policy isn't respected and the Fortimanager actually pushes to all devices.
This seems to be because the Fortigate device specified with "fortigate_name" is passed as a list item for the "scope" parameter to the API endpoint (/securityconsole/install/package)
args = dict(
adom=adom,
adom_rev_comments=module.params["adom_revision_comments"],
adom_rev_name=module.params["adom_revision_name"],
dev_rev_comments=module.params["fortigate_revision_comments"],
flags=module.params["install_flags"],
pkg=package,
scope=[fortigate]
)
The scope parameter, according to the API doc should be
scope object, refer to device object, or group object
Target device or device group.
"object member": [ { "name": "...", "vdom": "..." }, { "name": "..." }, ... ]
When referencing to a device, the object should contain both "name" and "vdom".
When referencing to other objects (ie. device groups), only the name attribute is used.
The API behaviour with the current format of the scope parameter seems to be to revert to push to all Fortigate devices.
(Tested on FortiManager 5.6.8)