Description
This article describes the application of Terraform on FortiManager. Terraform is an open-source tool for the provisioning of devices and is applicable to FortiManager as well.
Scope
FortiManager.
Solution
1) Installation of Terraform:
Terraform can be installed on multiple platforms including Linux, MacOS, or Windows. Links are provided below:
https://developer.hashicorp.com/terraform/downloads?product_intent=terraform
Note:
Use the command below to check Terraform is installed successfully:
terraform - - version
2) Enable JSON rpc read-write on admin users:
Go to FortiManager -> System Setting -> Admin -> Administrators -> Edit the user -> Select Read-Write on JSON API Access.
3) Create a file with .tf for Terraform:
4) Configure the .tf for Terraform to apply the configuration on FortiManager:
Notes:
Terraform command for FortiManager can be found in the link below:
https://registry.terraform.io/providers/fortinetdev/fortimanager/latest/docs
5) After all the commands are configured, execute terraform CLI command in the terminal with the sequence below:
a) Terraform init.
Terraform init will initiate the provider and plugin for FortiManager:
b) Terraform plan.
Terraform plan will preview the changes or configuration performed on FortiManager:
c) Terraform apply.
Terraform apply will perform the changes or configuration on the FortiManager.
After 3 of the action above is succeeded, the configuration will be applied on FortiManager:
Related link:
https://registry.terraform.io/providers/fortinetdev/fortimanager/latest/docs