citrix / terraform-provider-citrix

Terraform provider for Citrix
Apache License 2.0
41 stars 5 forks source link

citrix_delivery_group issue when setting multiple pool size schedules #42

Closed kgilbertwams closed 3 months ago

kgilbertwams commented 3 months ago

I'm trying to set autoscale using the following code:

  autoscale_settings = {
    timezone          = "Pacific Standard Time"
    autoscale_enabled = true
    power_time_schemes = [
      {
        days_of_week = [
          "Monday",
          "Tuesday",
          "Wednesday",
          "Thursday",
          "Friday"
        ]
        name         = "Weekdays"
        display_name = "Weekdays"
        peak_time_ranges = [
          "06:00-18:00"
        ]
        pool_size_schedules = [
          {
            pool_size  = 2
            time_range = "06:00-18:00"
          },
          {
            pool_size  = 1
            time_range = "00:00-06:00"
          },
          {
            pool_size  = 1
            time_range = "18:00-00:00"
          },
        ]
        pool_using_percentage = false
      },
      {
        days_of_week = [
          "Saturday",
          "Sunday"
        ]
        name         = "Weekends"
        display_name = "Weekends"
        peak_time_ranges = [
          "06:00-18:00"
        ]
        pool_size_schedules = [
          {
            time_range = "00:00-00:00",
            pool_size  = 1
          }
        ]
        pool_using_percentage = false
      },
    ]
  }

Unfortunately, when I configure this I receive errors below about them being continuous time ranges.

│ Error: Incorrect Attribute Value │ │ with citrix_delivery_group.default_dg, │ on delivery_groups.tf line 1, in resource "citrix_delivery_group" "default_dg": │ 1: resource "citrix_delivery_group" "default_dg" { │ │ Unexpected time_range value 00:00-06:00. Contiguous time ranges should be combined. ╵ ╷ │ Error: Incorrect Attribute Value │ │ with citrix_delivery_group.default_dg, │ on delivery_groups.tf line 1, in resource "citrix_delivery_group" "default_dg": │ 1: resource "citrix_delivery_group" "default_dg" { │ │ Unexpected time_range value 17:30-00:00. Contiguous time ranges should be combined.

Is there a proper way to configure this schedule? I tried changing the setting manually on the live system, and in the returned plan it shows what is deployed formatted in a similar fashion:

- pool_size_schedules   = [
  - {
    - pool_size  = 2 -> null
    - time_range = "06:00-17:30" -> null
    },
 - {
   - pool_size  = 1 -> null
   - time_range = "00:00-06:00" -> null
   },
- {
  - pool_size  = 1 -> null
  - time_range = "17:30-00:00" -> null
   },
] -> null

Luckily, as a workaround I can remove the autoscale code completely and then manually set the autoscale schedule on the delivery group in the portal to be able to get the plan to execute properly.

aneeshk-citrix commented 3 months ago

Hi @kgilbertwams,

Thank you for reporting this issue. We are looking into it and will have it fixed in the next release.

Aneesh