Issue with genesyscloud_architect_schedules

Hello,

We are getting very odd behaviour when we attempt to create a schedule (genesyscloud_architect_schedules object) using Terraform MyPureCloud client version 1.23.0.

Schedule file:
resource "genesyscloud_architect_schedules" "tsls_dt_0701xxxx_0000-0859" {
name = "name"
division_id = division_id
description = "description"
start = "2024-07-01T00:00:00.000000"
end = "2024-07-01T08:59:59.000000"
rrule = "FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=01"
}

Steps:

  1. Terraform reports that an object will be created:
    module.architect_schedules.genesyscloud_architect_schedules.tsls_dt_0701xxxx_0000-0859 will be created

  2. The log then prints the following message for 5 minutes:
    module.architect_schedules.genesyscloud_architect_schedules.tsls_dt_0701xxxx_0000-0859: Still creating... [5m0s elapsed]

  3. The run then errors out with the following:
    Error: mismatch on attribute rrule:
    expected value: FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=01
    actual value: FREQ=YEARLY;INTERVAL=1;BYMONTH=7;BYMONTHDAY=1

The issues/troubleshooting:

  1. According to the actual value in the error, the rrule in our file is correct
  2. Even though the run reports an error, the schedule actually got created in the environment
  3. Checking the schedule through the API call, it appears the API response is not using 0-padding for month and day
    {
    "id": "...",
    "name": "name",
    ...
    "state": "active",
    "modifiedByApp": "public-api-v2/7567 (i-0291180f22200f1a4)",
    "createdByApp": "public-api-v2/7567 (i-0291180f22200f1a4)",
    "start": "2024-07-01T00:00:00.000",
    "end": "2024-07-01T08:59:59.000",
    "rrule": "FREQ=YEARLY;INTERVAL=1;BYMONTH=7;BYMONTHDAY=1",
    ...
    }

I suspect point 3 above is the "root cause" but don't have any way to prove it.

Thank you.

Hello,

Not that I have tried this resource, but the error you see doesn't mean your rrule is correct.
It is just stating that the expected value (what you had in your terraform config) is different from what is returned by the API after object creation (actual value). And it is probably what bothers the terraform process.

Could you just modify your terraform config and remove this 0 padding for month and day?
I mean: rrule = "FREQ=YEARLY;INTERVAL=1;BYMONTH=7;BYMONTHDAY=1"
I assume this should solve your issue.
The rrule is just a string for the terraform plugin.

Regards,

Hi Jmakcek,

The issue is the API is mutating the value you are submitting. Terraform expects the value to match sent to the API to match what it is coming back. In this case, the API takes a looser set of values and "munges" them into a standard format. We ran into this same problem with phone numbers and it is one of the reasons why we enforce an E164 format on all phone numbers.

Per Jerome's comments, you can work around this issue by making sure your submitted string matches what the API is going to expect. In the meantime, I will open a ticket in our backlog and see if we can some more upfront validation.

Thanks,
John Carnell
Director, Developer Engagement

Hello,

Removing 0-pad from Cx-As-Code worked, thank you.

I think the error message still needs to be flipped: Expected value should be without 0-pad, while the actual value, in our case, was 0-padded.

Thank you.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.