VM resources
There are a couple of FortiFlex VM resources:
fortiflexvm_vms_create
You can create one or more VMs based on a FortiFlex configuration using the fortiflexvm_vms_create
resource. This API cannot be used to modify a VM. See fortiflexvm_vms_update for more information.
Example usage
resource "fortiflexvm_vms_create" "example"{ config_id = 42 description = "Create through Terraform" end_date = "2023-11-11T00:00:00" folder_path = "My Assets" vm_count = 1 }
Once you declare a resource block and use terraform apply, any modification to this resource block will create new VMs when you use terraform apply again. For example, if you used the resource block in the example above to apply one VM, you will create two more VMs by replacing the value of |
Argument reference
The following arguments are supported:
Argument |
Type |
Description |
---|---|---|
config_id
|
Number (Required) |
The ID of the FortiFlex configuration. |
|
String (Optional) |
The description of the VMs. |
|
String (Optional) |
The VM end date. It cannot be before the current date or after the program's end date. Any format that satisfies ISO 8601 is accepted but the recommended format is |
|
String (Optional) |
The folder path of the VMs. |
|
Number (Optional) |
The number of VMs to be created. The default value is 1. |
Attribute reference
The following attribute is exported:
Attribute |
Type |
Description |
---|---|---|
id
|
String |
An ID for the resource. |
Import
You cannot import this resource.
fortiflexvm_vms_update
You can update, stop, or reactivate a VM, or regenerate a VM token with the fortiflexvm_vms_update
resource. By using this resource, you can change the data in the FortiFlex platform immediately. However, it may take several hours for the VMs to update their licenses automatically.
You can use fortiflexvm_vms_create to create VMs. The status of newly created VMs is |
Example usage
resource "fortiflexvm_vms_update" "example"{ serial_number = "FGVMMLTM0000XXXX" config_id = 42 description = "Modify through Terraform" end_date = "2023-11-11T00:00:00" regenerate_token = false status = "DISABLE" }
If you want to update the |
Argument reference
The following arguments are supported:
Argument |
Type |
Description |
---|---|---|
|
String (Required) |
The unique serial number of the VM to be updated. |
config_id
|
Number (Required if you want to update |
Set a new FortiFlex configuration. |
|
String (Optional) |
Set a new description. |
|
String (Optional) |
Set a new end date. Any format that satisfies ISO 8601 is accepted but the recommended format is |
|
Boolean (Optional) |
Defines whether or not to regenerate a new token. If the argument is |
|
String (Optional) |
Set the status as |
Attribute reference
The following attribute is exported:
Attribute |
Type |
Description |
---|---|---|
id
|
String |
An ID for the resource. |
Import
One VM profile can be imported.
To import a VM profile:
-
Specify the
config_id
when you configure the provider:provider "fortiflexvm" { username = "ABCDEFG" password = "HIJKLMN" import_options= toset(["config_id=42"]) }
-
Import the VM profile:
terraform import fortiflexvm_vms_update.labelname {{serial_number}}