fortinetdev / terraform-provider-fortios

Terraform Fortios provider
https://www.terraform.io/docs/providers/fortios/
Mozilla Public License 2.0
69 stars 50 forks source link

How to reorder shaping policies #329

Closed zippanto closed 2 weeks ago

zippanto commented 3 months ago

Hi,

I'm very sorry to create a duplicate issue of #176 , but I suspect the Fortinet GitHub user that responded in the original issue is not active anymore and so it's not possible to get any attention.

Please could we get a response either here on the original issue. Is this issue being looked at?

Thanks.

MaxxLiu22 commented 3 months ago

Hi @zippanto ,

Thank you for raising this issue. I have informed the development team about this feature, and they will add it in the next release.

Thanks, Maxx

MaxxLiu22 commented 1 month ago

Hi @zippanto,

I wanted to let you know that this issue has been resolved in Terraform FOS 1.21.0. Starting with this version, Terraform now supports reorder and move shaping policies. Here is an example to reorder them based on the desired order. Whenever you have a chance, please upgrade to Terraform FOS 1.21.0, and feel free to reach out if you have any further questions.

variable name {
  type        = list
  default     = ["a", "f", "zgt", "za", "zzz", "334", "25", "1689"]
  description = "description"
}

resource "fortios_firewall_shapingpolicy" "trname" {
  for_each = toset(var.name)
  class_id             = 0
  diffserv_forward     = "disable"
  diffserv_reverse     = "disable"
  diffservcode_forward = "000000"
  diffservcode_rev     = "000000"
  internet_service     = "disable"
  internet_service_src = "disable"
  ip_version           = "4"
  name                 = each.key
  status               = "enable"
  tos                  = "0x00"
  tos_mask             = "0x00"
  tos_negate           = "disable"

  dstaddr {
    name = "all"
  }

  dstintf {
    name = var.interface2
  }

  service {
    name = "ALL"
  }

  srcaddr {
    name = "all"
  }
}

resource "fortios_firewall_shapingpolicy_sort" "test" {
    force_recreate    = 21315
    sortby            = "name"
    sortdirection     = "manual"
    manual_order   = var.name

  depends_on = [
    fortios_firewall_shapingpolicy.trname
  ]
}

Thank you, Maxx

MaxxLiu22 commented 2 weeks ago

I will proceed with closing this case. However, feel free to reopen it if you continue to experience this issue.