MyPureCloud / terraform-provider-genesyscloud

Terraform Provider Genesyscloud
MIT License
34 stars 77 forks source link

Random Data Resource loading issue with genesyscloud_routing_skill_group #1086

Closed viniljose closed 1 week ago

viniljose commented 3 weeks ago

I use Data Source to load skill for a queue. I always have multiple Queues to be created which depends on multiple skill groups. I first apply the skill group with Terraform using GC Provider. When I use Data Source of skill group during queue creation, It fails to load some of the skill groups even if it exists in UI. E.g there there were total new 6 skill groups created through TF. Later when using this for creating queue, 3 of them were identifiable, rest 3 its says "Error: context deadline exceeded" I check for the spelling and its correct. I tried to push this to a different org , then issue persists but this time , issue was with different set of skills groups. If I hard code the id I got from state and comment the data source call, it works. I tried different versions from 1.33 to 1.37 issue persists

data "genesyscloud_routing_skill_group" "Test123" { name = "Test123" }
skill_groups       = ["${genesyscloud_routing_skill_group.Test123.id}"]

In the logs it shows something like below data.genesyscloud_routing_skill_group.Test123: Still reading... [6m0s elapsed] Many retries with below Retry #1 for GET https://api.usw2.pure.cloud/api/v2/routing/skillgroups: Many 429 errors Response 429 Too Many Requests for request:GET https://api.usw2.pure.cloud/api/v2/routing/skillgroups:

charliecon commented 3 weeks ago

Hi @viniljose

You mentioned that you first apply the skill group with Terraform. In that case, why are you using the skill group data source when you can reference the skill group resource directly? Data sources are usually used to reference existing Genesys Cloud objects that aren't managed under Terraform.

viniljose commented 3 weeks ago

@charliecon I have a different backend state file for queue and skill group..I want to manage the resources separately. So TF state of queue,wont be knowing about the skill group. I use Data sources for dependency resolution in other places as well , all works except skill group. In skill group, some of them works and some of the wont work. I need help to understand why some of them are not working.

charliecon commented 3 weeks ago

I understand. There were changes made to the skill groups data source on v1.40.0 of the genesyscloud provider. If you haven't already, would you mind upgrading to this version and checking if you're still seeing these issues?

viniljose commented 3 weeks ago

Thank You , I will check and update back.

viniljose commented 3 weeks ago

@charliecon I tried with 1.40.0 and 1.40.1 but same issue persists. Can you please help me to understand which particular PR in changelog talks about the skill group changes you mentioned above?

viniljose commented 2 weeks ago

@charliecon did you get a chance to check this?

charliecon commented 2 weeks ago

Hi @viniljose . Sorry for the delay.

I was referring to PR 1064. I was wrong to refer to that PR. It edited the skill data source - not skill groups.

I was just looking through the code for the skill groups data source and I think I found a mistake that could have caused the behaviour that you're seeing. I will get to work on it now and keep you posted here.

viniljose commented 2 weeks ago

Thank You @charliecon , Please update here once you push the change through a release.

charliecon commented 2 weeks ago

Hey @viniljose

I just made the required changes. If you want, you can locally compile our project and test out the changes yourself. This may also be a way for you to get around your problem until the next release. It will also let us know if my changes fix the behaviour you're seeing, before the official release.

You will just need to clone this project, make sure you are on the branch no-jira-issue-1086, then run make sideload from the root of the project. Then you will need to update the reference to our provider in your Terraform configuration to look like this:

genesyscloud = {
  source  = "genesys.com/mypurecloud/genesyscloud"
  version = "0.1.0"
}

After running terraform init -upgrade , you should be using the locally compiled version.

This process is described here in our README file

Otherwise, you can wait for our next release which is scheduled for next Tuesday, the 25th of June.

-Charlie

viniljose commented 2 weeks ago

Thank You @charliecon for the update I will check this and update back

charliecon commented 1 week ago

Hey @viniljose

Quick update - the changes I made were released in v1.41.0

I'm going to close this issue for now. If the problem persists, feel free to re-open the issue or create a new one.

-Charlie