Skip to content

Commit

Permalink
init/updateFlexVMTerraform: 2.3.2
Browse files Browse the repository at this point in the history
Signed-off-by: FTNT-HQCM <hq-devops-admin@fortinet.com>
  • Loading branch information
FTNT-HQCM committed Jun 17, 2024
1 parent 4685a62 commit e1685cc
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 12 deletions.
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
## 2.4.0 (Unreleased)

## 2.3.2 (June 17, 2024)

IMPROVEMENTS:

* Supported 2 new configurations: `FortiAP Hardware` (`fap_hw`) and `FortiSwitch Hardware` (`fsw_hw`).
* Configuration `faz_vm` added one new argument `addons`.
* `fortiflexvm_entitlements_vm` supported new input argument `skip_pending`.


## 2.3.1 (April 3, 2024)

IMPROVEMENTS:

* Supported 2 new configurations: `FortiSASE` (`fortisase`) and `FortiEDR` (`fortiedr`).
* `fortiflex_config` supported input argument `config_id`. You can import existing configurations by specifying this argument.
* `fortiflex_retrieve_vm_group` supported input argument `retrieve_status`. It can retrieve both PENDING and STOPPED entitlements if you set `retrieve_status = ["STOPPED", "PENDING"]`.
* `fortiflex_retrieve_vm_group` supported input argument `require_exact_count`. The default value is false, if set as true, the resource will release retrieved entitlements and report an error if the resource doesn't get enough `count_num` entitlements.
* `fortiflexvm_config` supported input argument `config_id`. You can import existing configurations by specifying this argument.
* `fortiflexvm_retrieve_vm_group` supported input argument `retrieve_status`. It can retrieve both PENDING and STOPPED entitlements if you set `retrieve_status = ["STOPPED", "PENDING"]`.
* `fortiflexvm_retrieve_vm_group` supported input argument `require_exact_count`. The default value is false, if set as true, the resource will release retrieved entitlements and report an error if the resource doesn't get enough `count_num` entitlements.
* Reported a warning rather than an error if `end_date` in `fortiflexvm_entitlements_vm` is set incorrectly.

## 2.3.0 (Feburary 23, 2024)
Expand Down
45 changes: 44 additions & 1 deletion fortiflexvm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
)

var PRODUCT_TYPES = []string{"fgt_vm_bundle", "fmg_vm", "fwb_vm", "fgt_vm_lcs", "fc_ems_op", "faz_vm",
"fpc_vm", "fad_vm", "fgt_hw", "fwbc_private", "fwbc_public", "fc_ems_cloud", "fortisase", "fortiedr"}
"fpc_vm", "fad_vm", "fgt_hw", "fap_hw", "fsw_hw", "fwbc_private", "fwbc_public", "fc_ems_cloud",
"fortisase", "fortiedr"}

func fortiAPIPatch(t interface{}) bool {
if t == nil {
Expand Down Expand Up @@ -46,6 +47,10 @@ func convProductTypeName2Id(p_type string) int {
return 9
case "FGT_HW":
return 101
case "FAP_HW":
return 102
case "FSW_HW":
return 103
case "FWBC_PRIVATE":
return 202
case "FWBC_PUBLIC":
Expand Down Expand Up @@ -81,6 +86,10 @@ func convProductTypeId2Name(p_id int) string {
return "FAD_VM"
case 101:
return "FGT_HW"
case 102:
return "FAP_HW"
case 103:
return "FSW_HW"
case 202:
return "FWBC_PRIVATE"
case 203:
Expand Down Expand Up @@ -192,6 +201,18 @@ func convConfParsId2NameList(p_id int) (string, string, string) {
return "fortisase", "dedicated_ips", "int"
case 52:
return "fortiedr", "addons", "list"
case 53:
return "fsw_hw", "device_model", "string"
case 54:
return "fsw_hw", "service_pkg", "string"
case 55:
return "fap_hw", "device_model", "string"
case 56:
return "fap_hw", "service_pkg", "string"
case 57:
return "fap_hw", "addons", "list"
case 58:
return "faz_vm", "addons", "list"
default:
return "", "", ""
}
Expand Down Expand Up @@ -272,6 +293,8 @@ func convConfParsNameList2Id(p_type, c_name string) int {
return 22
case "support_service":
return 23
case "addons":
return 58
default:
return 0
}
Expand Down Expand Up @@ -302,6 +325,26 @@ func convConfParsNameList2Id(p_type, c_name string) int {
default:
return 0
}
case "fsw_hw":
switch c_name {
case "device_model":
return 53
case "service_pkg":
return 54
default:
return 0
}
case "fap_hw":
switch c_name {
case "device_model":
return 55
case "service_pkg":
return 56
case "addons":
return 57
default:
return 0
}
case "fwbc_private":
switch c_name {
case "average_throughput":
Expand Down
42 changes: 42 additions & 0 deletions fortiflexvm/data_source_configs_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ func dataSourceConfigsList() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"addons": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
Expand Down Expand Up @@ -250,6 +255,43 @@ func dataSourceConfigsList() *schema.Resource {
},
},
},
"fap_hw": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"device_model": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"service_pkg": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"addons": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
"fsw_hw": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"device_model": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"service_pkg": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
},
},
"fwbc_private": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Expand Down
55 changes: 54 additions & 1 deletion fortiflexvm/resource_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ func resourceConfig() *schema.Resource {
FPC_VM: FortiPortal Virtual Machine;
FAD_VM: FortiADC Virtual Machine;
FGT_HW: FortiGate Hardware;
FAP_HW: FortiAP Hardware;
FSW_HW: FortiSwitch Hardware;
FWBC_PRIVATE: FortiWeb Cloud - Private;
FWBC_PUBLIC: FortiWeb Cloud - Public;
FC_EMS_CLOUD: FortiClient EMS Cloud;
FORTISASE: FortiSASE;
FORTIEDR: FortiEDR.`,
ValidateDiagFunc: checkInputValidString("product_type", []string{"FGT_VM_Bundle", "FMG_VM", "FWB_VM", "FGT_VM_LCS",
"FC_EMS_OP", "FC_EMS_CLOUD", "FAZ_VM", "FPC_VM", "FAD_VM", "FGT_HW", "FWBC_PRIVATE", "FWBC_PUBLIC", "FORTISASE", "FORTIEDR"}),
"FC_EMS_OP", "FC_EMS_CLOUD", "FAZ_VM", "FPC_VM", "FAD_VM", "FGT_HW", "FAP_HW", "FSW_HW",
"FWBC_PRIVATE", "FWBC_PUBLIC", "FORTISASE", "FORTIEDR"}),
},
"status": &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -248,6 +251,12 @@ func resourceConfig() *schema.Resource {
Optional: true,
Computed: true,
},
"addons": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
Expand Down Expand Up @@ -309,6 +318,50 @@ func resourceConfig() *schema.Resource {
},
},
},
"fap_hw": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"device_model": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"service_pkg": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"addons": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
"fsw_hw": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"device_model": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"service_pkg": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
},
},
},
"fwbc_private": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Expand Down
8 changes: 8 additions & 0 deletions fortiflexvm/resource_entitlements_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func resourceEntitlementsVM() *schema.Resource {
Optional: true,
Computed: true,
},
"skip_pending": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"start_date": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -104,6 +109,9 @@ func resourceEntitlementsVMCreate(ctx context.Context, d *schema.ResourceData, m
if v, ok := d.GetOk("folder_path"); ok {
obj["folderPath"] = v
}
if v, ok := d.GetOk("skip_pending"); ok {
obj["skipPending"] = v
}
if v, ok := d.GetOk("end_date"); ok {
obj["endDate"] = v
}
Expand Down
Loading

0 comments on commit e1685cc

Please sign in to comment.